up previous next
ScientificStr --
convert integer/rational to a floating-point string
|
ScientificStr(X: INT|RAT|RINGELEM): STRING
ScientificStr(X: INT|RAT|RINGELEM, Prec: INT): STRING |
This function converts a rational number
X into a (decimal)
floating-point string. The optional second argument
Prec says how many
decimal digits to include in the mantissa; the default value is 5.
The exponent is always included (even if it is zero).
/**/ ScientificStr(2/3); -- last printed digit is rounded
6.6667*10^(-1)
/**/ ScientificStr(7^510); -- almost no limit on exponent range
1.0000*10^431
/**/ ScientificStr(1/81, 35); -- specify number of digits
1.2345679012345679012345679012345679*10^(-2)
/**/ ScientificStr(1/2); -- trailing zeroes are not suppressed
5.0000*10^(-1)
|