fixnums - Fixnum arithmetic

LIBRARY

(import (rnrs arithmetic fixnums))

DESCRIPTION

Every implementation must define its fixnum range as a closed interval [−2^(w−1), 2^(w−1)−1] such that w is a (mathematical) integer w ≥ 24. Every mathematical integer within an implementation’s fixnum range must correspond to an exact integer object that is representable within the implementation. A fixnum is an exact integer object whose value lies within this fixnum range.

Fixnum operations perform integer arithmetic on their fixnum arguments, but raise an exception with condition type &implementation-restriction if the result is not a fixnum.

IMPLEMENTATION NOTES

GNU Guile
Guile runs generic arithmetic faster than fixnums. If the numbers are of a certain width (e.g. 32-bit) then they should be to truncated with bitwise-and.
IronScheme
IronScheme stores fixnums on the heap. Remember to not use eq?, assq or memq on fixnums. (This applies to Scheme as such, not just IronScheme).

STANDARDS

R6RS

SEE ALSO

fixnum-width(3scm)

AUTHORS

This page is part of the scheme-manpages 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.