Page: 10 prev next


Example



The number 2.5 is represented exactly in double precision IEEE floating point notation as

11000000001010100000000000000000000000000000000000000000000000000

since it can be written as

2.5 = 1 * 2^1 + 0 * 2^0 + 1 * 2^-1..

The number 2.4 is represented as

11000000001010011001100110011001100110011001100110011001100110011.

However, it cannot be represented exactly because it can't be written as a sum of powers of two in a range allowed by the fixed word length.

The error caused by rounding 2.4 to its floating-point representation is less than 9x10-17. The exact decimal representation of the binary floating-point value is

2.399999999999999911182158029987476766109466552734375.