Next: Defining Smobs, Previous: Defining Ptobs, Up: Data Types [Contents][Index]
A smob is a miscellaneous datatype. The type code and GCMARK bit
occupy the lower order 16 bits of the CAR
half of the cell. The
rest of the CAR
can be used for sub-type or other information.
The CDR
contains data of size long and is often a pointer to
allocated memory.
Like ptobs, new varieties of smobs can be defined dynamically (see Defining Smobs). These are the initial smobs:
unused cell on the freelist.
single-precision float.
Inexact number data types are subtypes of type tc16_flo
. If the
sub-type is:
CDR
.
CDR
is a pointer to a malloc
ed double.
CDR
is a pointer to a malloc
ed pair of doubles.
double-precision float.
double-precision complex.
positive and negative bignums, respectively.
Scm has large precision integers called bignums. They are stored in
sign-magnitude form with the sign occuring in the type code of the SMOBs
bigpos and bigneg. The magnitude is stored as a malloc
ed array
of type BIGDIG
which must be an unsigned integral type with size
smaller than long
. BIGRAD
is the radix associated with
BIGDIG
.
NUMDIGS_MAX
(defined in scmfig.h) limits the number of
digits of a bignum to 1000. These digits are base BIGRAD
, which
is typically 65536, giving 4816 decimal digits.
Why only 4800 digits? The simple multiplication algorithm SCM uses is O(n^2); this means the number of processor instructions required to perform a multiplication is some multiple of the product of the number of digits of the two multiplicands.
digits * digits ==> operations 5 x 50 100 * x 500 10000 * x 5000 1000000 * x
To calculate numbers larger than this, FFT multiplication [O(n*log(n))] and other specialized algorithms are required. You should obtain a package which specializes in number-theoretical calculations:
made by DELAY. See Control features in Revised(5) Scheme.
synchronization object. See Process Synchronization.
macro expanding function. See Macro Primitives.
multi-dimensional array. See Arrays.
This type implements both conventional arrays (those with arbitrary data as elements see Conventional Arrays) and uniform arrays (those with elements of a uniform type see Uniform Array).
Conventional Arrays have a pointer to a vector for their CDR
.
Uniform Arrays have a pointer to a Uniform Vector type (string, Vbool,
VfixZ32, VfixN32, VfloR32, VfloR64, or VfloC64) in their CDR
.
Next: Defining Smobs, Previous: Defining Ptobs, Up: Data Types [Contents][Index]