This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home. For a version of this page that may be more recent, see NumericTower in WG2's repo for R7RS-large.

Numeric­Tower

cowan
2012-04-04 11:32:38
16history
source

The numeric tower

This is an analysis of the R5RS provision that the full numeric tower may be subsetted. Five boolean feature settings characterize different kinds of numeric towers: exactness-preserving, ratios, inexact, and complex, and exact-complex. These refer respectively to the closure of exact numbers under rational operations (except /), exact non-integer values, inexact rationals, non-real numbers, and exact non-real numbers. Of course, exact-complex can only be true if complex is true.

So here are some numeric towers that have implementations. I use + if a feature is present and - if it is absent, and give a general description of the resulting tower.

||exactness-preserving||ratios||inexact||complex||exact-complex||Description||Examples

-

-

-

-

-

A "toy" tower with fixnums (bounded exact integers) only. Possibly appropriate where no numerical work will be done.

SigScheme

-

-

+

-

-

A fixnum-flonum Scheme where all numbers are real and all arithmetic happens in essentially constant time.

Chicken (default numbers), Shoe*, TinyScheme*, RScheme, BDC*, XLisp*, Schemik*, VX, SXM*, Inlab, Sixx, Sizzle (also Elisp*, C*)

-

-

+

+

-

The complex-number equivalent of the preceding.

Stalin

-

+

+

+

-

Limited-range exact and inexact numbers.

Scheme 7

-

+

+

+

+

Limited-range exact and inexact numbers, including exact non-reals.

Wraith

+

-

+

-

-

Exact integers and inexact real numbers, a good all-round compromise.

Bigloo, Scheme 9, Elk (also ISLisp)

+

-

+

+

-

The same as the preceding, but with inexact complex numbers as well.

SCM

+

+

-

-

-

Exact rational numbers only. Reasonable for some purposes, but will often run very slowly without inexact support, so unsuitable for scientific-type work.

Dream, Oaklisp, Owl Lisp

+

+

+

-

-

Full numeric tower with real numbers only.

Psyche, Ikarus, Rep, Elk (also Clojure)

+

+

+

+

-

Full numeric tower with inexact complex numbers only.

Gauche, Guile, SISC, KSi, UMB

+

+

+

+

+

Full numeric tower with both exact and inexact complex numbers.

Racket, MIT, Gambit, Chicken with the numbers egg, Scheme48/scsh, Kawa, Chibi, Chez, Vicare, Larceny, Ypsilon, Mosh, IronScheme, STklos, Spark (also Common Lisp)

*These systems are technically exactness-preserving but don't return the right answers when their arithmetic overflows.

See NumericTowerManisComments for Vincent Manis's comments on an earlier version of this page.

See also ComplexRepresentations.