Node:Numerical Tower, Next:Integers, Up:Numbers
Scheme's numerical "tower" consists of the following categories of numbers:
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.
number? predicate may be applied to any Scheme value to
discover whether the value is any of the supported numerical types.
|number? obj||Scheme Procedure|
|scm_number_p (obj)||C Function|
(number? 3) => #t (number? "hello there!") => #f (define pi 3.141592654) (number? pi) => #t
The next few subsections document each of Guile's numerical data types in detail.