All real numbers that have more than 1 representation in IEEE-754 of single precision

≡放荡痞女 提交于 2019-12-11 00:44:55

问题


the question is as follows :

Write down all the real numbers that have more than 1 representation in IEEE-754 of single precision.

Now, considering +0 and -0 are different, are there any numbers that have this property?


回答1:


There are none.

The IEEE754 representation is canonical, which means that all numbers have precisely one representation if any, and no others.

Format of an IEEE754 single-precision floating-point number

31                             0
seeeeeeeemmmmmmmmmmmmmmmmmmmmmmm

Mapping to

(-1)^s * 2^(eeeeeeee - 127) * 1.mmmmmmmmmmmmmmmmmmmmmmm (binary)

Proof of uniqueness of representation

  • The sign is encoded in the sign bit, s. Two putatively different representations of the same real number must have the same value of s, because only that field controls the sign.
  • The location of the most-significant 1-bit, in digit positions left from the decimal comma, is encoded in biased format in the eight eeeeeeee exponent bits. Two putatively different representations of the same real number must have the same value of eeeeeeee, because only that field controls the position of the most significant 1-bit.
  • The 23 bits immediately below the most-significant 1-bit are encoded in the mantissa (mmmm...). Two putatively different representations of the same real number would have to have the same mantissa value, because only that field controls the 23 bits immediately below the most-significant 1-bit of the real number.

The conclusion is a contradiction. Two putatively different representations of a same real number would have to have the same sign, exponent and mantissa; In other words they must be identical.

This discussion ignores all the special values, like infinities, NaNs and denormals.



来源:https://stackoverflow.com/questions/17251767/all-real-numbers-that-have-more-than-1-representation-in-ieee-754-of-single-prec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!