up previous next
DecimalStr --
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 the rational
number
X
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, 50);
0.33333333333333333333333333333333333333333333333333
/**/ DecimalStr(123.456789);
123.457
|