[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In some situations you will need an integer type of a well-defined size. For this purpose, GNU Pascal provides three families of signed and unsinged integer types. The type
Integer (42) |
is guaranteed to have a precision of 42 bits. In a realistic context, you will most often give a power of two as the number of bits, and the machine you will need it on will support variables of that size. If this is the case, the specified precision will simultaneously be the amount of storage needed for variables of this type.
In short: If you want to be sure that you have a signed integer with 32 bits width, write `Integer (32)', not just `Integer' which might be bigger. The same works with `Cardinal' and `Word' if you need unsigned integer types of well-known size.
This way, you can't get a higher precision than that of `LongestInt' or `LongestCard' (see section 8.2.3.2 The Main Branch of Integer Types). If you need higher precision, you can look at the `GMP' unit (see section 8.14.5 Arithmetic with unlimited size and precision) which provides integer types with arbitrary precision, but their usage is different from normal integer types.