在单精度IEEE-754中具有超过1个表示形式的所有实数 [英] All real numbers that have more than 1 representation in IEEE-754 of single precision
问题描述
问题如下:
写下所有具有大于1的单精度IEEE-754表示形式的实数。
Write down all the real numbers that have more than 1 representation in IEEE-754 of single precision.
现在,考虑到+0和-0不同,是否有任何数字具有该属性?
Now, considering +0 and -0 are different, are there any numbers that have this property?
推荐答案
没有。
IEEE754表示为 canonical ,这意味着所有数字都只有一个表示形式(如果有的话),而没有其他表示形式。
The IEEE754 representation is canonical, which means that all numbers have precisely one representation if any, and no others.
31 0
seeeeeeeemmmmmmmmmmmmmmmmmmmmmmm
映射到
(-1)^ s * 2 ^(eeeeeeee-127)* 1.mmmmmmmmmmmmmmmmmmmmmmmmm(二进制)
(-1)^s * 2^(eeeeeeee - 127) * 1.mmmmmmmmmmmmmmmmmmmmmmm (binary)
- 符号编码在符号位
s
。相同的实数的两个假定的不同表示形式必须具有相同的s
值,因为只有该字段控制符号。 -
1
位的最高有效位的位置(在十进制逗号左起的数字位置)以8位eeeeeeee
指数位。相同的实数的两个假定的不同表示形式必须具有相同的eeeeeeeeee
值,因为只有该字段控制最高1位的位置。 - 最重要的
1
位正下方的23位编码为尾数(mmmm ...
)。两个相同实数的推定不同表示形式必须具有相同的尾数值,因为只有该字段才控制紧接在最高有效1
位以下的23位。实数。
- The sign is encoded in the sign bit,
s
. Two putatively different representations of the same real number must have the same value ofs
, 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 eighteeeeeeee
exponent bits. Two putatively different representations of the same real number must have the same value ofeeeeeeee
, 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-significant1
-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.
此讨论忽略了所有特殊值,例如无穷,NaN和非正规数。
This discussion ignores all the special values, like infinities, NaNs and denormals.
这篇关于在单精度IEEE-754中具有超过1个表示形式的所有实数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!