Integer vs floating point numbers in IEEE single format

445 Views Asked by At

Can any integer number between the smallest and largest positive normal floating-point numbers in IEEE single format be stored exactly in this floating-point system?
If yes, please explain, possibly providing an example.

1

There are 1 best solutions below

0
On

No.

In IEEE-754 binary32, a finite number is represented in the format ± x.xxxxxx2 • 2e, where each x is a bit, there are 23 bits after the “.”, and −126 ≤ e ≤ 127. It is in normal form if the first x is 1. So the largest positive normal number representable is + 1.111…1112 • 2127 = (2 − 2−23) • 2127 = 2128 − 2104.

The smallest positive normal number is + 1.000…0002 • 2−126 = 2−126. Between these lies the integer 224+1 = 16,777,217. This integer is not representable because, in binary, it is 1000…00012, where there are 23 zero bits between the ones, making 25 bits in total, so it cannot be represented in the form ± x.xxxxxx2 • 2e, which has just 24 bits in the significand.