numerator, denominator, flnumerator, fldenominator  compute numerator and denominator
LIBRARY
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
(import (rnrs arithmetic flonums)) ;R6RS
SYNOPSIS
(denominator q)
(numerator q)
(fldenominator fl)
(flnumerator fl)
DESCRIPTION
These procedures return the numerator or denominator of their
argument.
The result is computed as if the argument was represented as a
fraction in lowest terms. The denominator is always positive. The
denominator of 0 is defined to be 1.
RETURN VALUES
Returns a single value; an integer with the same exactness as the
argument.
EXAMPLES
(numerator (/ 6 4)) => 3
(denominator (/ 6 4)) => 2
(denominator
(inexact (/ 6 4))) => 2.0
(numerator 5) => 5
(denominator 5) => 1
RATIONALE
These procedures, or their equivalents, are used internally in many
arithmetic procedures. Since they must exist somewhere in the
implementation it makes sense to provide them to the user.
COMPATIBILITY
These procedures work the same everywhere, except that R7RS
implementations are allowed to not support all types of numbers.
ERRORS
This 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.
In particular,
q
must be a rational number and
fl
must be a flonum object.
 R7RS

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.
SEE ALSO
rationalize(3scm),
realpart(3scm),
gcd(3scm),
divandmod(3scm)
STANDARDS
R4RS,
IEEE Scheme,
R5RS,
R6RS,
R7RS
HISTORY
These procedures first appeared in R3RS.
The flonum variants are new to R6RS's flonum library.
AUTHORS
This page is part of the
schememanpages
project.
It includes materials from the RnRS documents.
More information can be found at
https://github.com/schemedoc/manpages/
.
Markup created by unroff 1.0sc, March 04, 2023.