SXEmacs supports two numeric data types: integers and floating point numbers. Integers are whole numbers such as -3, 0, #b0111, #xFEED, #o744. Their values are exact. The number prefixes ‘#b’, ‘#o’, and ‘#x’ are supported to represent numbers in binary, octal, and hexadecimal notation (or radix). Floating point numbers are numbers with fractional parts, such as -4.5, 0.0, or 2.71828. They can also be expressed in exponential notation: 1.5e2 equals 150; in this example, ‘e2’ stands for ten to the second power, and is multiplied by 1.5. Floating point values are not exact; they have a fixed, limited amount of precision.
SXEmacs can be compiled to use a multi-precision arithmetic library with the –enable-ent switch. Currently the MP-libraries GMP, BSD-MP, MPFR and MPC are supported. We have a dedicated section for this case, See Enhanced Number Types.
|• Integer Basics:||Representation and range of integers.|
|• Float Basics:||Representation and range of floating point.|
|• Predicates on Numbers:||Testing for numbers.|
|• Comparison of Numbers:||Equality and inequality predicates.|
|• Numeric Conversions:||Converting float to integer and vice versa.|
|• Arithmetic Operations:||How to add, subtract, multiply and divide.|
|• Rounding Operations:||Explicitly rounding floating point numbers.|
|• Bitwise Operations:||Logical and, or, not, shifting.|
|• Math Functions:||Trig, exponential and logarithmic functions.|
|• Random Numbers:||Obtaining random integers, predictable or not.|