CoCoA:FloatApprox

From ApCoCoAWiki
Revision as of 10:02, 24 October 2007 by XMLBot (talk | contribs) (pushing XML rev. 1.46, again)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

FloatApprox

approx. of rational number of the form <formula>M*10^E</formula>

Description

This function computes an approximation of the form <formula>M*10^E</formula> 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 <ttref>MantissaAndExponent</ttref>.

Example

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

Syntax

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

DecimalStr

FloatStr

MantissaAndExponent

   <type>rat</type>