Mondo Math Libs
By Eric Olson2003-08-22
Ground rules
Before I get into the specifics of various libraries and where to find them, let's agree on some terminology.
The most widely quoted and used standard for floating point numbers is IEEE-754, which defines several data formats and exactly how various bit patterns in the fields are interpreted. (See Resources later in this column for an online guide to IEEE-754.)
Mantissa and exponent refer to the two parts of binary-format floating point numbers as they are normally represented. The mantissa is the "base" part of the number, and the exponent is the power of ten (usually) the base is raised to. In decimal, the number 5.12e+3 has a mantissa of 5.12 and an exponent of 3.
Precision measures a number's "size" in terms of the exact number of digits it can represent. This can be deceptive to the floating-point neophyte, however. Don't think that because an IEEE-754 single precision number can store a maximum number of 3.40292347e+38 that it can represent every possible floating point number up to that value (or down to the negative of that value). An IEEE-754 single has a mantissa of only 23 bits, and you can't possibly represent 38 decimal digits in only 23 bits. This is typical of binary floating point number representations: their exponents exceed their grasp. But precision doesn't just refer to floating point values; it's also applicable to integers.
I can't stress enough that floating point is one area where you should pay attention to exactly how your data is represented, particularly when dealing with software-only implementations, such as MPM libs. In those cases, you're using an artificial construct that was simply invented by a programmer, and not something supported in hardware.
Tutorial Pages:
» A look at some of the math libraries for Linux
» Ground rules
» Binary vs. decimal
» Some contenders
» Java's BigInteger and BigDecimal
» Hints and tips
» Resources
First published by
| Related Tutorials: » How to Install PHP 5 on Linux » How to Install Apache 2 on Linux » How to Install MySQL 5.0 on Linux » SMB Caching » Mound --Bind » Tar Wild Card Interpretation |
