Previous Up Next

10.1.1  Digits

The Digits variable (see Section 3.5.1) is used to control how real numbers are represented and also how they are displayed. When the specified number of digits is less or equal to 14 (for example Digits:=14), then hardware floating point numbers are used and they are displayed using the specified number of digits. When Digits is larger than 14, Xcas uses the MPFR library, the representation is similar to hardware floats (cf. infra) but the number of bits of the mantissa is not fixed and the range of exponents is much larger. More precisely, the number of bits of the mantissa of a created MPFR float is ceil(Digits*log(10)/log(2)).

Note that if you change the value of Digits, this will affect the creation of new real numbers compiled from command lines or programs or by instructions like approx, but it will not affect existing real numbers. Hence hardware floats may coexist with MPFR floats, and even in MPFR floats, some may have 100 bits of mantissa and some may have 150 bits of mantissa. If operations mix different kinds of floats, the most precise kind of floats are coerced to the less precise kind of floats.


Previous Up Next