up previous next
ScientificStr

convert integer/rational to a floating-point string

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

Description
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. Note that an exponent is always included.

Example
/**/  ScientificStr(2/3);       -- last printed digit is rounded
6.6667*10^(-1)

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

/**/  ScientificStr(1/81, 50);  -- precision of mantissa specified by user
1.2345679012345679012345679012345679012345679012346*10^(-2)

/**/  ScientificStr(1/2);       -- trailing zeroes are not suppressed
5.0000*10^(-1)

See Also