floating-pointlanguage-agnosticdiscrete-mathematics

Floating point representation of a real number is not unique


I am reading about floating point representation of real numbers.
In any real number system with arithmetic base β, a real number x can be represented as
x=(0.d1d2 --- dtdt+1---) β X βe (1)
where 0≤di≤β-1
Now consider (0.5)10 in binary system.
In binary system, (0.5){10}=(0.1)2 (2)
But we can see that 1/2=(1/22)+(1/23)+----
(0.5)10=(0.01111---)2 (3)

From (2) and (3) we can see that the same number has two floating point representation.

I have read that such ambiguities can be removed by considering the "normalized floating point representation" i.e.,
d1 ≠ 0

But with the normalized floating point representation, we still have the ambiguity.
(0.5)10=(0.100000)2 (2(a))
(0.5)10=((0.1111111----) X 2-1) (3(a))

So from (2(a)) and (3(a)) we can see that the ambiguity is not resolved still even with normalized floating point representation. Can somebody please tell whether I am right. And how to resolve this ambiguity?


Solution

  • ... with the normalized floating point representation, we still have the ambiguity.

    No ambiguity.


    (2(a)) (0.5)10 = (0.100000)2
    (3(a))I (0.5)10 = ((0.1111111----)2 X 2-1 (as an infinite series)
    (3(a))F (0.5)10 = ((0.1111111----)2 X 2-1 (as a finite series)

    (2(a)) is true.
    (3(a))I is true.
    (3(a))F is false as the number of terms in a floating point value is finite. This is no more true than 1.0 equals 0.999999999999999.

    (3(a))I is not possible with common binary floating point. All finite values have only 1 encoding, except +0.0 and -0.0.