Scheme Programmer's Manual
NAME
fixnum-width - the width of the fixnum range
LIBRARY
(import (rnrs)) ;R6RS
(import (rnrs arithmetic fixnums)) ;R6RS
SYNOPSIS
(fixnum-width)
DESCRIPTION
The fixnum range is defined as the closed interval
[−2^(w−1), 2^(w−1)−1]
such that w is an implementation-defined integer w ≥ 24.
This procedure returns the implementation's w.
IMPLEMENTATION NOTES
The fixnum width depends very much on implementation details and the
machine. Here are some known fixnum widths.
- Chez Scheme
-
-
The fixnum width is 61 or 30. If the machine's register width is
m then the fixnum width is m - log2(m/8).
- GNU Guile
-
The fixnum width is 62 or 30. This is the machine's register width
minus two.
- IronScheme
-
The fixnum width is 32.
- Loko Scheme
-
The fixnum width is 61.
RETURN VALUES
Returns a single fixnum equal to or larger than 24.
EXAMPLES
If the fixnum width is 32 (or greater) then fixnums can represent all
signed 32-bit integers.
(fixnum-width) => 61
APPLICATION USAGE
This procedure is sometimes used in libraries that provide optimized
variants of code for implementations where the fixnum width is large
enough.
COMPATIBILITY
This procedure is only present in R6RS. An alternative is
(+ 1 (bitwise-length (greatest-fixnum))).
ERRORS
This procedure never raises an exception.
SEE ALSO
greatest-fixnum(3),
least-fixnum(3)
STANDARDS
R6RS
AUTHORS
This page is part of the
scheme-manpages
project.
It includes materials from the RnRS documents.
More information can be found at
Index
- NAME
-
- LIBRARY
-
- SYNOPSIS
-
- DESCRIPTION
-
- IMPLEMENTATION NOTES
-
- RETURN VALUES
-
- EXAMPLES
-
- APPLICATION USAGE
-
- COMPATIBILITY
-
- ERRORS
-
- SEE ALSO
-
- STANDARDS
-
- AUTHORS
-
Return to Main Contents