1.9: Inexact Numbers
- Last updated
-
May 31, 2022
-
Save as PDF
-
Example:
so that and , or in binary, . How is represented in binary? To compute binary number, multiply successively by 2 as follows:
so that exactly in binary is With only 23 bits to represent , the number is inexact and we have
where we have rounded to the nearest binary number (here, rounded up). The machine number is then represented as
or in hex
Find smallest positive integer that is not exact in single pre- cision
Let be the smallest positive integer that is not exact. Now, I claim that
and
The integer would then require a one-bit in the position, which is not available. Therefore, the smallest positive integer that is not exact is . In MATLAB, single has the same value as single Since single is exactly halfway between the two consecutive machine numbers and , MATLAB rounds to the number with a final zero-bit in , which is