Copyright (C) 2000-2012 |
GNU Info (guile.info)Numerical TowerScheme's Numerical "Tower" -------------------------- Scheme's numerical "tower" consists of the following categories of numbers: * 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. - primitive: number? obj Return `#t' if OBJ is any kind of number, `#f' else. For example: (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. automatically generated by info2www version 1.2.2.9 |