up previous next
convert rational number to decimal string
DecimalStr(X: INT|RAT|RINGELEM): STRING
DecimalStr(X: INT|RAT|RINGELEM, NumDigits: INT): STRING |
This function produces a decimal string representation of a rational number
with up to
NumDigits
digits after the decimal point. If not specified,
the default number of digits is 3.
If
X
is a
RINGELEM
, it is automatically converted to a
RAT
.
/**/ DecimalStr(1/3);
0.333
/**/ DecimalStr(1/3, 60);
0.333333333333333333333333333333333333333333333333333333333333
/**/ DecimalStr(123.456789);
123.457
|