Technical Considerations
32
Technical Considerations
as binary
For example, 1/2 (0.5 in decimal) can be represented exactly in binary as 0.1. Other real numbers that can be represented exactly in decimal have repeating digits in binary and hence cannot be represented exactly, as shown below. For example, 1/10, or decimal 0.1 exactly, is 0.000110011 . . . in binary.
Errors of this kind are unavoidable in any computer approximation of real numbers. Because of these errors, sums of fractions are often slightly incorrect. For example, 4/3 Ð 5/6 is not exactly equal to 1/2 on any computer, even on computers that use IEEE standard arithmetic.
Fraction | Decimal approximation* | Binary approximation |
1/10 | 0.1000000000à | 0.000110011001100110011001101 |
1/2 | 0.5000000000à | 0.100000000000000000000000à |
4/3 | 1.333333333 | 1.01010101010101010101011 |
5/6 | 0.8333333333 | 0.110101010101010101010101 |
4/3 Ð 5/6 | 0.4999999997 | 0.100000000000000000000001 |
* 10 significant digits 23 significant digits à Exact value
The IEEE standard defines data formats for
■basic arithmetic operations (add, subtract, multiply, divide, square root, remainder, and
■conversion operations, which convert numbers to and from the
■comparison operations, such as less than, greater than, and equal to
■environmental control operations, which manipulate the
The IEEE standard requires that the basic arithmetic operations have the following attributes:
■The result must be accurate in the precision in which the operation is performed. When a numerics environment is performing a
■If the result cannot be represented exactly in the destination data format, it must be changed to the closest value that can be represented, using rounding.
iMalc Manual