### 7.3.1 Evaluating a real at a given precision

A real number is an exact number and its numeric evaluation at a given precision is a floating number represented in base 2. The precision of a floating number is the number of bits of its mantissa, which is at least 53 (hardware float numbers, also known as double).

Floating numbers are displayed in base 10 with a number of digits controlled by the user either by assigning the Digits variable or by modifying the CAS configuration (see Section 2.5.7, item 2.5.7). By default, Digits is equal to 12.

The number of digits displayed controls the number of bits of the mantissa; if Digits is less than 15, 53 bits are used, if Digits is strictly greater than 15, the number of bits is a roundoff of Digits times log2(10).

An expression can be coerced into a floating number with the evalf command (see Section 7.3.1). The evalf command may have an optional second argument which will specify the precision to use.

Note that if an expression contains a floating number, evaluation will try to convert other arguments to floating point numbers in order to coerce the whole expression to a single floating number.

#### Examples

1+1/2

3
2

1.0+1/2

1.5 |  |  |  |  |  |  |  |  |  |

exp(pi*sqrt(20))

e |
2 π | √ |
5

evalf(exp(pi*2*sqrt(5)))

1263794.75367 |  |  |  |  |  |  |  |  |  |

1.1^20

6.72749994932 |  |  |  |  |  |  |  |  |  |

sqrt(2)^21

| √ |
2
| · 210

Input for a result with 30 digits:

Digits:=30

Input for the numeric value of eπ√163:

evalf(exp(pi*sqrt(163)))

0.262537412640768743999999999985×108 |  |  |  |  |  |  |  |  |  |

Note that Digits is now set to 30. You could have entered:

evalf(exp(pi*sqrt(163)),30)

if you didn’t want to change the value of Digits.