Previous Up Next

4.1.1  Digits

The Digits variable 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 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 commandlines 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