Next: Interactive Lisp Functions, Previous: Internals, Up: Internals

Integers are stored in either of two ways, depending on their magnitude. Integers less than one million in absolute value are stored as standard Lisp integers. This is the only storage format for Calc data objects which is not a Lisp list.

Large integers are stored as lists of the form ‘`(bigpos d0
d1 d2 ...)`’ for sufficiently large positive integers
(where “sufficiently large” depends on the machine), or
‘

The distinction between small and large integers is entirely hidden from
the user. In `defmath`

definitions, the Lisp predicate `integerp`

returns true for either kind of integer, and in general both big and small
integers are accepted anywhere the word “integer” is used in this manual.
If the distinction must be made, native Lisp integers are called fixnums
and large integers are called bignums.

Fractions are stored as a list of the form, ‘`(frac n d)`’
where

Floating-point numbers are stored in the form, ‘`(float mant
exp)`’, where

Rectangular complex numbers are stored in the form ‘`(cplx re
im)`’, where

Polar complex numbers are stored in the form ‘`(polar r
theta)`’, where

Hours-minutes-seconds forms are stored as ‘`(hms h m
s)`’, where

Date forms are stored as ‘`(date n)`’, where

Modulo forms are stored as ‘`(mod n m)`’, where

Error forms are stored as ‘`(sdev x sigma)`’, where

Interval forms are stored as ‘`(intv mask lo hi)`’,
where

Vectors are stored as ‘`(vec v1 v2 ...)`’, where

Variables are stored as ‘`(var name sym)`’, where

`#`

signs (which are converted to hyphens internally), the form is
‘`#`

characters, and `-`

characters instead. The value of a variable is the Calc
object stored in its `nil`

, the variable has no
value. Special constants have the form ‘A Lisp list with any other symbol as the first element is a function call.
The symbols `+`

, `-`

, `*`

, `/`

, `%`

, `^`

,
and `|`

represent special binary operators; these lists are always
of the form ‘`( op lhs rhs)`’ where

`neg`

represents unary negation; this list is always
of the form ‘`nil`

or call `reject-arg`

to signify
that they should be left in symbolic form, or they should return a Calc
object which represents their value, or a list of such objects if they
wish to return multiple values. (The latter case is allowed only for
functions which are the outer-level call in an expression whose value is
about to be pushed on the stack; this feature is considered obsolete
and is not used by any built-in Calc functions.)