# Convert decimal number in binary double precision, how to avoid the loss of the last digits after normalization?

I have the decimal number: $$0.023$$, and I want to convert in a binary number with $$52$$ bit of mantissa in Double Precision:

• if I go to convert, using this utility here, in non-normalized form, with $$52$$ bits I have:

$$0.0000010111100011010100111111011111001110110110010001$$

so when I go to normalize I obtain, the integer part not stored, and then 52 digits, I have done the zero-filled after the shifting to the left:

$$1.0111100011010100111111011111001110110110010001\underbrace{000000}_{\text{zero fill}} \times 2^{-6}$$

and that's the result expected to me! This is my proceeding!

• Instead, if I go to convert, using this utility here, directly in a normalized form, I have:

$$1.0111100011010100111111011111001110110110010001\underbrace{01101}_{\star}$$

• How is it possible to have that, not all zeros 5 digits in $$\star$$?
• Is there exists an additional register to memorize that five digits and then retrieve them after the shifting of the normalization, and therefore append them?

Please, can you help me? Many thanks!

## 1 Answer

If you first convert to non-normalized form and then normalize, you will of course get the zeros at the end simply because the normalization can not know what else to put in there.

But that's not how one converts decimal numbers into floating point. One does the normalization first, of course, and only then computes the digits past the (binary) point.

• You've said "One does the normalization first, of course, and only then computes the digits past the (binary) point": i.e.: it is like solving an 'handmade excercise' using, for example, the method with successive multiplication: in each step, one must throw away whatever 0 digits encounters till the very first 1 digit. The number of these preliminary steps determines the exponent. The very first 1 it is written down followed by a binary point, and then, it is licit to write down each digits one encounters during the procedure. So, do you mean this, with "one does the normalization first"? – JB-Franco May 27 '20 at 9:39
• @JB-Franco Yes. – Wolfgang Bangerth May 27 '20 at 15:47