Scheme Programmer's Manual
NAME
fixnumwidth  the width of the fixnum range
LIBRARY
(import (rnrs)) ;R6RS
(import (rnrs arithmetic fixnums)) ;R6RS
SYNOPSIS
(fixnumwidth)
DESCRIPTION
The fixnum range is defined as the closed interval
[−2^(w−1), 2^(w−1)−1]
such that w is an implementationdefined 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 32bit integers.
(fixnumwidth) => 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 (bitwiselength (greatestfixnum))).
ERRORS
This procedure never raises an exception.
SEE ALSO
greatestfixnum(3),
leastfixnum(3)
STANDARDS
R6RS
AUTHORS
This page is part of the
schememanpages
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