up previous next
FloatStr

convert rational number to a decimal string

Syntax
FloatStr(X: INT|RAT|RINGELEM): STRING
FloatStr(X: INT|RAT|RINGELEM, Prec: INT): STRING

Description
This function produces a decimal string representation of the rational number X . The optional second argument Prec says how many significant decimal digits to produce; the default value is 5. The aim is to produce an easily readable result.

Example
/**/  FloatStr(2/3);      -- last printed digit is rounded
0.66667

/**/  FloatStr(7^510);    -- no arbitrary limit on exponent range
1.0000*10^431

/**/  FloatStr(1/81, 50);    -- precision of mantissa specified by user
0.012345679012345679012345679012345679012345679012346

/**/  FloatStr(987654/321);
3076.8

See Also