The Digits Environment Variable - Maple Programming Help

# Online Help

###### All Products    Maple    MapleSim

Home : Support : Online Help : Programming : Evaluation : Digits

The Digits Environment Variable

 Calling Sequence Digits := n

Parameters

 n - natural number

Description

 • The Digits environment variable controls the number of digits that Maple uses when making calculations with software floating-point numbers.
 • The default value of Digits is 10. The value of Digits is changed by using the assignment operator.
 • Maple fully evaluates environment variables such as Digits in all contexts. Because Digits is an environment variable, any assignments to it inside a procedure body are undone upon exit from the procedure.
 • The maximum value of Digits is obtained from kernelopts(maxdigits).
 • The interface(displayprecision) command controls the number of decimal places to be displayed, which is determined by Digits. This allows for simplification of display without introducing round-off error.

Examples

 > $\mathrm{Digits}≔20$
 ${\mathrm{Digits}}{≔}{20}$ (1)
 > f := proc()     print( "Entering f. Digits is", Digits );     Digits := Digits + 17;     print( "Adding 17 to Digits yields", Digits ); end proc:
 > $f\left(\right)$
 ${"Entering f. Digits is"}{,}{20}$
 ${"Adding 17 to Digits yields"}{,}{37}$ (2)
 > $\mathrm{Digits}$
 ${20}$ (3)

When returning from f in the procedure above, Maple resets Digits to its value on entry.

 > ${1.02}^{10}$
 ${1.2189944199947571302}$ (4)
 > $\mathrm{Digits}≔5$
 ${\mathrm{Digits}}{≔}{5}$ (5)
 > ${1.02}^{10}$
 ${1.2190}$ (6)
 > $\mathrm{interface}\left(\mathrm{displayprecision}=5\right)$
 ${-1}$ (7)
 > $\mathrm{Digits}≔20$
 ${\mathrm{Digits}}{≔}{20}$ (8)
 > $a≔\mathrm{evalf}\left(\frac{1}{3}\right)$
 ${a}{≔}{0.33333}$ (9)
 > $a\cdot 3$
 ${1.00000}$ (10)

 See Also