exact, inexact - conversion between exact and inexact numbers
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme base)) ;R7RS
; R5RS legacy names
(import (rnrs r5rs)) ;R6RS
(import (scheme r5rs)) ;R7RS
; R5RS legacy names
procedure returns an exact representation of
The value returned is the exact number object that is numerically
closest to the argument; in most cases, the result of this procedure
should be numerically equal to its argument.
procedure returns an inexact representation of
If inexact number objects of the appropriate type have bounded precision,
then the value returned is an inexact number object that is nearest to
- Large numbers
For a real number object whose magnitude is finite but
so large that it has no reasonable finite approximation as an inexact
number, a reasonably close inexact equivalent may be
Similarly, the inexact representation of a complex number object whose
components are finite may have infinite components.
procedures are idempotent. This means that if they are called with a
number that already has the desired exactness, then they return that
- Complex numbers (R7RS)
For complex numbers that do not already have the desired exactness,
the result is a complex number whose real and imaginary parts are the
result of applying the procedure to the real and imaginary parts of
the argument, respectively.
Returns a single exact or inexact number object, respectively.
These procedures are used to manage the exactness used in computations.
R7RS implementations are not required to support the full numeric
These procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.
- &implementation-restriction (R6RS)
May be raised if an inexact argument has no reasonably close exact
equivalent, or an exact argument has no reasonably close inexact
The assertions described above are errors.
Implementations may signal an error, extend the procedure's
domain of definition to include such arguments,
or fail catastrophically.
An implementation restriction may be reported under the circumstances
described above for
indicating that the implementation is unable to continue execution of
a correct program. It may also be reported by the
procedure when its argument is an inexact non-integral real.
These procedures were called
in R5RS and earlier reports.
This page is part of the
It includes materials from the RnRS documents.
More information can be found at
Markup created by unroff 1.0sc, March 04, 2023.