Numbers in CIGAL can be either integers or floating point numbers.
If a number contains a decimal point then it is stored as a 32-bit
floating point number with approximately 7 significant digits. Floating
point numbers are always decimal (base 10). Some examples of floating
point numbers are:
10. 123.456 .0032 0.12
If a number is entered as an integer, without a decimal point, then it
can be in base 2, 4, 8, 10, or 16. The base is determined by the presence
of a letter at the end of the number. If there is no letter, then the
base is determined by the value of the internal variable IBASE, which is
10 (decimal) by default (see IBASE[4]). However, you can specify the base
explicitly for any number by ending the number with the letter 'b', 'q',
'o', 'd', or 'h' which specify base 2, 4, 8, 10, or 16 respectively. The
following table gives some examples for each base with the corresponding
decimal values in parentheses (the examples assume IBASE = 10):
Base Range of digits Examples Decimal values
==== =============== ======== ==============
2 0-1 10b, 101B, 100110b 2, 5, 38
4 0-3 10q, 31Q, 1231q 4, 13, 109
8 0-7 10o, 27O, 1321o 8, 23, 721
10 0-9 10d, 33, 3214 10, 33, 3214
16 0-f 10h, 0fH, 0b3ah 16, 15, 2874
Anytime that you enter a number in CIGAL you can enter the number in
any base by using the base specifying characters. This is true whether you
are entering numbers on a command line or as part of data input (see
DATAENTRY[1]). You can freely intermix different bases, integers, or
floating point integers from one number to the next.
Note: As usual for hexadecimal numbers, the single character values
corresponding to 10-15 are expressed as the letters a-f. Because the
command line parser identifies numbers by the fact that the first
character is a digit, hexadecimal numbers that start with an a-f must be
preceded by an initial '0' to avoid being interpreted as character
strings. Letters that are part of a number can be either upper or lower
case.
Numbers are stored within CIGAL in one of seven different formats. The
storage format is determined by the type of variable (see VARIABLES[1]).
The formats are:
Name Storage Range of legal values
==== ======= =====================
Bit unsigned 1 bit integer 0 - 1
Crumb unsigned 2 bit integer 0 - 3
Nibble unsigned 4 bit integer 0 - 15
Byte unsigned 8 bit integer 0 - 255
Integer signed 16 bit integer -32767 - 32767
Long signed 32 bit integer -2147483647 - 2147483647
Real signed 32 bit floating pt. 7 significant digits
The range of legal values for signed integers is one number less than
the maximum range possible because the most negative value (-0: the sign bit
set to 1, followed by all zeros) is reserved for a 'missing value' code (see
ARITHMETIC[1]).
NOTE: CIGAL currently has some bugs when dealing with very large LONG
integers; it tends to round them off to about 7 significant digits.