1
$\begingroup$

Theorem: Prove every number in double precision 32-bit floating-point format can be represented in double precision 64-bit floating point-format.

64-bit format: enter image description here

Attempt: Let $ b = b_0 ,...,b_{31} $ be a binary string of 32 bits. Define a binary string of 64-bits $ a = a_0,...,a_{63} $ as follows:
$ a_0 = b_0 $, $ ~~~~ a_1 = b_1,...,a_8 = b_8 $, $~~~~ a_9=a_{10} = a_{11} = 0 $, $~~~ a_{12} = b_9 ,...,a_{34} = b_{31}~ $, $~~~ a_{35} = a_{36} = ... = a_{63} $. Note that the binary string $ a $ as a float in 64-bits has the same sign and fraction of binary string $ b $ as a float in 32-bits, since: $ a_0 = b_0 $ ( signs are the same ), $ \forall 1 \leq i \leq 8. a_i = b_i .$ and $ \sum_{k=1}^{52} a_{k+11} \cdot 2^{-k} = \sum_{k=1}^{23} a_{k+11} \cdot 2^{-k} = \sum_{k=1}^{23} b_{k+8} \cdot 2^{-k} $ ( fractions are the same ). We'll show that they both the same exponents, [ missing arguments ].

I got stuck in showing that both $ a $ and $ b $ have the same exponent, but it might not be true from my construction of $ a $ since If I take the following 32-bit float: enter image description here
we see that $ sign = 0 , fraction = 1 \cdot 2^{-2} = \frac{1}{4}$ , $ exp = (01111100)_2 = (124)_{10} $ so this floating point number represents $ (-1)^0 \cdot 2^{124-127} \cdot ( 1 + \frac{1}{4} ) = 0.15625 $. But according to my construction of $ a $ I get that $ exp =( 01111100000 )_2 $ which is $( 992)_{10} $, so I get that $ a $ represents $ (-1)^0 \cdot 2^{992 - 1023} \cdot ( 1 + \frac{1}{4} )$ which is a totally different number . hence I was stuck in proving the theorem. Can you please help? how would you prove the above theorem?

$\endgroup$

1 Answer 1

2
$\begingroup$

Ignoring denormalized numbers, infinities and the like, floating point formats can store numbers of the form $$ \pm \left(1 + \frac{x}{2^N}\right) \times 2^y, $$ where $0 \leq x < 2^N-1$ and $-M \leq y < M$; here $x,y$ are both integers, and $N,M$ are the parameters of the format. It's not hard to check that if you increase $N$ or $M$ then you can still represent all numbers that you used to be able to represent. This is what happens in your case.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.