# RR -- the class of all real numbers

## Description

A real number is entered as a sequence of decimal digits with a point. It is stored internally as an arbitrary precision floating point number, using the MPFR library.
 i1 : 3.14159 o1 = 3.14159 o1 : RR (of precision 53)
The precision is measured in bits, is visible in the ring displayed on the second of each pair of output lines, and can be recovered using precision.
 i2 : precision 3.14159 o2 = 53
For real numbers, the functions class and ring yield different results. That allows numbers of various precisions to be used without creating a new ring for each precision.
 i3 : class 3.1 o3 = RR o3 : InexactFieldFamily i4 : ring 3.1 o4 = RR 53 o4 : RealField
The precision can be specified on input by appending the letter p and a positive number.
 i5 : 3p300 o5 = 3 o5 : RR (of precision 300)
An optional exponent (for the power of ten to multiply by) can be specified on input by appending the letter e and a number.
 i6 : 3e3 o6 = 3000 o6 : RR (of precision 53) i7 : -3e-3 o7 = -.003 o7 : RR (of precision 53) i8 : -3p111e-3 o8 = -.003 o8 : RR (of precision 111)
Numbers that appear alone on an output line are displayed with all their meaningful digits. (Specifying 100 bits of precision yields about 30 decimal digits of precision.)
 i9 : 1/3. o9 = .333333333333333 o9 : RR (of precision 53) i10 : 1/3p100 o10 = .333333333333333333333333333333 o10 : RR (of precision 100) i11 : 100 * log(10,2) o11 = 30.1029995663981 o11 : RR (of precision 53)
Numbers displayed inside more complicated objects are printed with the number of digits specified by printingPrecision.
 i12 : printingPrecision o12 = 6 i13 : {1/3.,1/3p100} o13 = {.333333, .333333} o13 : List
The notion of equality tested by == amounts to equality of the internal binary digits.
 i14 : .5p100 == .5p30 o14 = true i15 : .2p100 == .2p30 o15 = false
The notion of (strict) equality tested by === also takes the precision into account.
 i16 : .5p100 === .5p30 o16 = false i17 : .2p100 === .2p30 o17 = false
Perhaps surprisingly, the IEEE floating point standard also specifies that every number, including 0, has a sign bit, and strict equality testing takes it into account, as it must do, because some arithmetic and transcendental functions take it into account.
 i18 : 0. o18 = 0 o18 : RR (of precision 53) i19 : -0. o19 = -0 o19 : RR (of precision 53) i20 : 1/0. o20 = infinity o20 : RR (of precision 53) i21 : 1/-0. o21 = -infinity o21 : RR (of precision 53) i22 : log 0 o22 = -infinity o22 : RR (of precision 53) i23 : csc (0.) o23 = infinity o23 : RR (of precision 53) i24 : csc (-0.) o24 = -infinity o24 : RR (of precision 53)
Use toExternalString to produce something that, when encountered as input, will reproduce exactly what you had before.
 i25 : x = {1/3.,1/3p100} o25 = {.333333, .333333} o25 : List i26 : x == {.333333, .333333} o26 = false i27 : y = toExternalString x o27 = {.33333333333333331p53,.33333333333333333333333333333346p100} i28 : x === value y o28 = true
Transcendental constants and functions are available to high precision, with numeric.
 i29 : numeric pi o29 = 3.14159265358979 o29 : RR (of precision 53) i30 : numeric_200 pi o30 = 3.14159265358979323846264338327950288419716939937510582097494 o30 : RR (of precision 200) i31 : Gamma oo o31 = 2.28803779534003241795958890906023392288968815335622244119938 o31 : RR (of precision 200)

## Functions and methods returning a real number :

• "QQ * RR" -- see * -- a binary operator, usually used for multiplication
• "RR * QQ" -- see * -- a binary operator, usually used for multiplication
• "RR * RR" -- see * -- a binary operator, usually used for multiplication
• "RR * ZZ" -- see * -- a binary operator, usually used for multiplication
• "ZZ * RR" -- see * -- a binary operator, usually used for multiplication
• "+ RR" -- see + -- a unary or binary operator, usually used for addition
• "QQ + RR" -- see + -- a unary or binary operator, usually used for addition
• "RR + QQ" -- see + -- a unary or binary operator, usually used for addition
• "RR + RR" -- see + -- a unary or binary operator, usually used for addition
• "RR + ZZ" -- see + -- a unary or binary operator, usually used for addition
• "ZZ + RR" -- see + -- a unary or binary operator, usually used for addition
• "- RR" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "QQ - RR" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "RR - QQ" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "RR - RR" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "RR - ZZ" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "ZZ - RR" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "QQ / RR" -- see / -- a binary operator, usually used for division
• "RR / QQ" -- see / -- a binary operator, usually used for division
• "RR / RR" -- see / -- a binary operator, usually used for division
• "RR / ZZ" -- see / -- a binary operator, usually used for division
• "ZZ / RR" -- see / -- a binary operator, usually used for division
• "abs(CC)" -- see abs -- absolute value function
• "abs(QQ)" -- see abs -- absolute value function
• "abs(RR)" -- see abs -- absolute value function
• "acos(RR)" -- see acos -- arccosine
• "agm(RR,RR)" -- see agm -- arithmetic-geometric mean
• "asin(RR)" -- see asin -- arcsine
• "atan(RR)" -- see atan -- compute the arctangent of a number
• "atan2(RR,RR)" -- see atan2 -- compute an angle of a certain triangle
• "BesselJ(ZZ,RR)" -- see BesselJ -- Bessel function of the first kind
• "BesselY(ZZ,RR)" -- see BesselY -- Bessel function of the second kind
• Beta(RR,RR) (missing documentation)
• "cos(RR)" -- see cos -- compute the cosine
• "cosh(RR)" -- see cosh -- compute the hyperbolic cosine
• "cot(RR)" -- see cot -- cotangent
• "coth(RR)" -- see coth -- hyperbolic cotangent
• "csc(RR)" -- see csc -- cosecant
• "csch(RR)" -- see csch -- hyperbolic cosecant
• "Digamma(RR)" -- see Digamma -- Digamma function
• "eint(RR)" -- see eint -- exponential integral
• erf(RR) (missing documentation)
• erfc(RR) (missing documentation)
• "exp(RR)" -- see exp -- exponential function
• "expm1(RR)" -- see expm1 -- exponential minus 1
• Gamma(RR) (missing documentation)
• Gamma(RR,RR) (missing documentation)
• inverseErf(RR) (missing documentation)
• inverseRegularizedBeta(RR,RR,RR) (missing documentation)
• inverseRegularizedGamma(RR,RR) (missing documentation)
• "log(RR)" -- see log -- logarithm function
• "log1p(RR)" -- see log1p -- logarithm of 1+x
• random(RR) -- random real number
• regularizedBeta(RR,RR,RR) (missing documentation)
• regularizedGamma(RR,RR) (missing documentation)
• "sec(RR)" -- see sec -- secant
• "sech(RR)" -- see sech -- hyperbolic secant
• "sin(RR)" -- see sin -- compute the sine
• "sinh(RR)" -- see sinh -- compute the hyperbolic sine
• "tan(RR)" -- see tan -- compute the tangent
• "tanh(RR)" -- see tanh -- compute the hyperbolic tangent
• "zeta(RR)" -- see zeta -- Riemann zeta function

## Methods that use a real number :

• "RR !" -- see ! -- factorial
• "CC % RR" -- see % -- a binary operator, usually used for remainder and reduction
• "RR % QQ" -- see % -- a binary operator, usually used for remainder and reduction
• "RR % RR" -- see % -- a binary operator, usually used for remainder and reduction
• "RR % ZZ" -- see % -- a binary operator, usually used for remainder and reduction
• "CC * RR" -- see * -- a binary operator, usually used for multiplication
• "RR * CC" -- see * -- a binary operator, usually used for multiplication
• "RR * RRi" -- see * -- a binary operator, usually used for multiplication
• "RRi * RR" -- see * -- a binary operator, usually used for multiplication
• "CC + RR" -- see + -- a unary or binary operator, usually used for addition
• "RR + CC" -- see + -- a unary or binary operator, usually used for addition
• "RR + RRi" -- see + -- a unary or binary operator, usually used for addition
• "RRi + RR" -- see + -- a unary or binary operator, usually used for addition
• "CC - RR" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "RR - CC" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "RR - RRi" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "RRi - RR" -- see - -- a unary or binary operator, usually used for negation or subtraction
• "CC / RR" -- see / -- a binary operator, usually used for division
• "RR / CC" -- see / -- a binary operator, usually used for division
• "RR / RRi" -- see / -- a binary operator, usually used for division
• "RRi / RR" -- see / -- a binary operator, usually used for division
• "CC // RR" -- see // -- a binary operator, usually used for quotient
• "InfiniteNumber // RR" -- see // -- a binary operator, usually used for quotient
• "RR // QQ" -- see // -- a binary operator, usually used for quotient
• "RR // RR" -- see // -- a binary operator, usually used for quotient
• "RR // ZZ" -- see // -- a binary operator, usually used for quotient
• "CC == RR" -- see == -- equality
• "QQ == RR" -- see == -- equality
• "RR == CC" -- see == -- equality
• "RR == QQ" -- see == -- equality
• "RR == RR" -- see == -- equality
• "RR == RRi" -- see == -- equality
• "RR == ZZ" -- see == -- equality
• "RRi == RR" -- see == -- equality
• "ZZ == RR" -- see == -- equality
• agm(CC,RR) (missing documentation)
• agm(RR,CC) (missing documentation)
• atan2(RR,RRi) (missing documentation)
• atan2(RRi,RR) (missing documentation)
• "clean(RR,Matrix)" -- see clean -- Set to zero elements that are approximately zero
• "clean(RR,MutableMatrix)" -- see clean -- Set to zero elements that are approximately zero
• "clean(RR,Number)" -- see clean -- Set to zero elements that are approximately zero
• "clean(RR,RingElement)" -- see clean -- Set to zero elements that are approximately zero
• "format(RR)" -- see format -- format a string or a real number
• InfiniteNumber == RR (missing documentation)
• InfiniteNumber ? RR (missing documentation)
• "interval(QQ,RR)" -- see interval -- construct an interval
• "interval(RR)" -- see interval -- construct an interval
• "interval(RR,QQ)" -- see interval -- construct an interval
• "interval(RR,RR)" -- see interval -- construct an interval
• "interval(RR,ZZ)" -- see interval -- construct an interval
• "interval(ZZ,RR)" -- see interval -- construct an interval
• "isc(RR)" -- see isc -- ISC lookup
• "isMember(RR,RRi)" -- see isMember -- membership test in an interval
• "isReal(RR)" -- see isReal -- whether a number is real
• "RR << ZZ" -- see left shift
• "lift(RR,type of QQ)" -- see lift -- lift to another ring
• "lift(RR,type of ZZ)" -- see lift -- lift to another ring
• "lngamma(RR)" -- see lngamma -- logarithm of the Gamma function
• "log(RR,RR)" -- see log -- logarithm function
• log(RR,CC) (missing documentation)
• log(RR,RRi) (missing documentation)
• log(RRi,RR) (missing documentation)
• MutableMatrix * RR (missing documentation)
• "norm(RR,Matrix)" -- see norm
• "norm(RR,MutableMatrix)" -- see norm
• "norm(RR,Number)" -- see norm
• "norm(RR,RingElement)" -- see norm
• "numeric(RR)" -- see numeric -- convert to floating point
• "promote(RR,type of QQ)" -- see promote -- promote to another ring
• random(RR,RR) -- random real number
• randomMutableMatrix(ZZ,ZZ,RR,ZZ) -- a random mutable matrix of integers
• "RR >> ZZ" -- see right shift
• "ring(RR)" -- see ring -- get the associated ring of an object
• "round(RR)" -- see round -- round a number
• "round(ZZ,RR)" -- see round -- round a number
• RR * MutableMatrix (missing documentation)
• RR == InfiniteNumber (missing documentation)
• RR ? InfiniteNumber (missing documentation)
• "size2(RR)" -- see size2 -- number of binary digits to the left of the point
• "sqrt(RR)" -- see sqrt -- square root function
• "toCC(RR)" -- see toCC -- convert to high-precision complex number
• "toCC(RR,RR)" -- see toCC -- convert to high-precision complex number
• "toCC(ZZ,QQ,RR)" -- see toCC -- convert to high-precision complex number
• "toCC(ZZ,RR)" -- see toCC -- convert to high-precision complex number
• "toCC(ZZ,RR,QQ)" -- see toCC -- convert to high-precision complex number
• "toCC(ZZ,RR,RR)" -- see toCC -- convert to high-precision complex number
• "toCC(ZZ,RR,ZZ)" -- see toCC -- convert to high-precision complex number
• "toCC(ZZ,ZZ,RR)" -- see toCC -- convert to high-precision complex number

## For the programmer

The object RR is , with ancestor classes InexactNumber < Number < Thing.