Storage type of numerical values

Numerical scalars and elements of matrices can be of the following storage types:
double: double precision floating point number. The value is between , where realmax is a built-in constant. A plain constant without suffix such as 123 or -11.75, is always stored as a double.
int: an integer of the natural size supported by the machine. The value is between two built-in constant intmin and intmax inclusive. A numerical literal with suffix Z, such as 37Z or -98Z is an int constant. Note that without suffix an integer constant is considered a double constant instead of an int.

byte: a small integer (one byte) with value between 0 and 256. The suffix for byte is B.
long integer: an integer of arbitrary size. The value can be any integer as long as the computer has enough memory to store it. A long constant is written with a terminal L, as in 325598728592935528L.
mpf: software floating point number with modifiable precision. The internal binary format of such a number is

where equals either 0 or 1, with unless all 's are zero, in which case the value of the number is zero. The value of is controled by global variable mpf_ndigits, and is a long integer. The suffix for an mpf constant is M. For example
x = 3.14159265358979323846264338327950M
The default value of mpf_ndigits is 128, therefore an mpf may have 128 significant binary digits as opposed to 52 for double. The value of mpf_ndigits. can be set to a multiple (at least 2) of 32.
Note: none of double, int, long, mpf, or byte is a keyword. There are several sets, namely _D, _Z, _B, _M, and _L, which are also built-in functions. They can be used to create matrices of various storage types, or test if a scalar or the element of a matrix belongs to a particular type.

oz 2009-12-22