Whether assigning of single precision IEEE754 float to double is reversible? Using the IEEE754 standard, let's assign single precision variable s to double precision variable d and then assign d to single precision variable s'.

Is this operation is reversible (lossless) for any value that can be represented in IEEE754, including NaN, infinity, etc.?  In other words, is it guaranteed that s = s' for all possible s?



On my processor NaN is not reversible (01 00 80 7f != 01 00 c0 7f).  Brute force shows that NaN is not reversible, but this might be implementation dependent, so please answer within the scope of IEEE754 standard.
Maybe this will help. This is not full answer - just information to think.


  5.3 Floating-Point Format Conversions
  It shall be possible to convert floating-point numbers between all supported formats. If the conversion is to a narrower
  precision, the result shall be rounded as specified in Section 4. Conversion to a wider precision is exact.


IEEE Std 754-1985