Next: , Up: baselib math   [Index]


4.6.1 Propagation of exactness and inexactness

The procedures listed below must return the mathematically correct exact result provided all their arguments are exact:

+            -            *
max          min          abs
numerator    denominator  gcd
lcm          floor        ceiling
truncate     round        rationalize
real-part    imag-part    make-rectangular

The procedures listed below must return the correct exact result provided all their arguments are exact, and no divisors are zero:

/
div          mod           div-and-mod
div0         mod0          div0-and-mod0

Moreover, the procedure expt must return the correct exact result provided its first argument is an exact real number object and its second argument is an exact integer object.

The general rule is that the generic operations return the correct exact result when all of their arguments are exact and the result is mathematically well–defined, but return an inexact result when any argument is inexact. Exceptions to this rule include:

sqrt            exp             log
sin             cos             tan
asin            acos            atan
expt            make-polar      magnitude
angle

which may (but are not required to) return inexact results even when given exact arguments, as indicated in the specification of these procedures.

One general exception to the rule above is that an implementation may return an exact result despite inexact arguments if that exact result would be the correct result for all possible substitutions of exact arguments for the inexact ones. An example is (* 1.0 0) which may return either 0 (exact) or 0.0 (inexact).