Computer Number Formats
- is the internal representation of numeric values in digital computer and calculator hardware and software
Format Types
| |
| |
| |
|
limited-precision decimal |
Basically the same as an IEEE 754 binary floating-point, except that the exponent is interpreted as base 10. As a result, there are no unexpected rounding errors. Also, this kind of format is relatively compact and fast, but usually slower than binary formats |
|
arbitrary-precision decimal |
Sometimes called “bignum”, this is similar to a limited-precision type but has the ability to increase the length of the significand (possibly also the exponent) as required. The downside is that there is some basic overhead (memory and speed) to support this flexibility and that the longer the significand gets, the more memory is needed and the slower all calculations become. It can be very tempting to say “My calculation is important, so I need as much precision as possible”, but in practice, the actual importance of precision at the 10,000th decimal digit quickly pales in comparison with the performance penalty required to support it. |
|
symbolic calculations |
The “holy grail” of exact calculations. Achieved by writing a program that actually knows all the rules of math and represents data as symbols rather than imprecise, rounded numbers. For example:
However, these symbolic math systems are complex, slow, and require significant mathematical knowledge to use. They are invaluable tools for mathematicians, but not appropriate for most everyday programming tasks. And even many mathematicians work on problems that are imprecise, numerical solutions are better because no symbolic solution is known. |