0

Within scope of IEEE754 standard let's assign single precision variable s to double precision variable d and then assign d to single precision variable s'.

Whether this operation is reversible(lossless) for any value that can be represented in IEEE754, including NaN, infinity, etc.

That is, whether s = s' for any s ?

Vlad
  • 129
  • I`m guessing there should be no loss of precision for ordinary numbers, since the s to d assignment should be an appropriate zero extension of the mantissa and the exponent. But if you have a denormalized number, I am not sure. – user_of_math May 02 '16 at 03:32
  • normalized decimal 0.1 will be in single as 00111101110011001100110011001101 and in double as 0011111110111001100110011001100110100000000000000000000000000000. Mantissa extended by zeros to the right, exponent not only by zeros to the left. So, single binary string is not substring of double (as short integer within integer). But single without leading zeros is substring of double. If exponent had been extended only by zeros then we would have very small number 1 × 2^-900 × 1.600000023841858 (instead of 1 × 2^-4 × 1.600000023841858) – Vlad May 02 '16 at 05:05
  • 3.14 is an example where only part of single's mantissa is substring of double representation (01000000010010010000111111011011 and 0100000000001001001000011111101101010100010001000010110100011000). So, reversion is not simple truncation. – Vlad May 02 '16 at 05:08

0 Answers0