up previous next
convert rational number to decimal string
DecimalStr(X:RAT):STRING
DecimalStr(X:RAT, NumDigits:INT):STRING
|
This function computes a decimal approximation with NumDigits
decimal digits of a rational number (default value is 3) and converts
it into a string for printing. If the returned string presents less
than NumDigits decimal digits, then the string represents the exact
value of the input.
DecimalStr(1/3);
0.333
-------------------------------
DecimalStr(1/3, 60);
0.333333333333333333333333333333333333333333333333333333333333
-------------------------------
DecimalStr(121/10);
12.1
-------------------------------
|