Node:Integer Data, Next:, Up:Immediate Datatypes Integers

Here are functions for operating on small integers, that fit within an SCM. Such integers are called immediate numbers, or INUMs. In general, INUMs occupy all but two bits of an SCM.

Bignums and floating-point numbers are non-immediate objects, and have their own, separate accessors. The functions here will not work on them. This is not as much of a problem as you might think, however, because the system never constructs bignums that could fit in an INUM, and never uses floating point values for exact integers.

int SCM_INUMP (SCM x) Macro
Return non-zero iff x is a small integer value.

int SCM_NINUMP (SCM x) Macro
The complement of SCM_INUMP.

int SCM_INUM (SCM x) Macro
Return the value of x as an ordinary, C integer. If x is not an INUM, the result is undefined.

SCM SCM_MAKINUM (int i) Macro
Given a C integer i, return its representation as an SCM. This function does not check for overflow.