up previous next
DecimalStr

convert rational number to decimal string

Syntax
DecimalStr(X: INT|RAT|RINGELEM): STRING
DecimalStr(X: INT|RAT|RINGELEM, NumDigits: INT): STRING

Description
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 .

Example
/**/  DecimalStr(1/3);
0.333

/**/  DecimalStr(1/3, 60);
0.333333333333333333333333333333333333333333333333333333333333

/**/  DecimalStr(123.456789);
123.457

See Also