up previous next
FloatApprox

approx. of rational number of the form M*10^E
Syntax

FloatApprox(X:RAT, RelErr:RAT):RAT


Description
This function computes an approximation of the form M*10^E to a rational number X and to within a maximum specified relative error. RelErr says indirectly how many decimal digits to include in the mantissa. Compare with MantissaAndExponent .

Example
  FloatApprox(1/3, 10^(-2));
333/1000
-------------------------------
  FloatApprox(1000000/3, 10^(-2));
333000
-------------------------------
  FloatApprox(1/3, 10^(-9));
3333333333/10000000000
-------------------------------


See Also