(guile.info.gz) Numerical Tower
21.2.1 Scheme's Numerical "Tower"
Scheme's numerical "tower" consists of the following categories of
* integers (whole numbers)
* rationals (the set of numbers that can be expressed as P/Q where P
and Q are integers)
* real numbers (the set of numbers that describes all possible
positions along a one dimensional line)
* complex numbers (the set of numbers that describes all possible
positions in a two dimensional space)
It is called a tower because each category "sits on" the one that
follows it, in the sense that every integer is also a rational, every
rational is also real, and every real number is also a complex number
(but with zero imaginary part).
Of these, Guile implements integers, reals and complex numbers as
distinct types. Rationals are implemented as regards the read syntax
for rational numbers that is specified by R5RS, but are immediately
converted by Guile to the corresponding real number.
The `number?' predicate may be applied to any Scheme value to
discover whether the value is any of the supported numerical types.
-- Scheme Procedure: number? obj
-- C Function: scm_number_p (obj)
Return `#t' if OBJ is any kind of number, else `#f'.
(number? "hello there!")
(define pi 3.141592654)
The next few subsections document each of Guile's numerical data
types in detail.
automatically generated byinfo2html