问题描述
浮点格式(IEEE)有32位。在符号的第一位之后,有8位用于偏置指数,之后是23位用于尾数。在这个尾数是第一个1(总是1)总是隐藏,这导致我的问题:数字0如何在这种格式?因为如果指数0的数字总是1.
加尾数永远是最小的1右?如果他们在尾数只有零,它会计为'1.0'...
我真的不明白这一点。
;其中2 ^ -127以下的数字近似为固定的,而不是浮点型指数。
实际上,零是一个正常次正规数。子异常以( - 1)signbits×2 ^ -126×0.significandbits
和指数全零编码。如果有效位为零,则结果为(+/-)零。
The float format (IEEE) has 32 bits. First bit for the sign, after that 8 bits for a biased exponent and after that another 23 bits for the mantissa. In this mantissa is the first 1 (is always 1) always hidden which leads me to my question:
how does the number 0 look like in this format? because if the exponents 0 the number will always be 1.plus the mantissa is always minimum 1 right? If they are only zeros in the mantissa it will count as '1.0'...
I really don't get this.
Wikipedia tells you:
0000 0000 = 0
8000 0000 = −0
Besides the normal float values, with exponent and mantisse there are a bunch of other irregular numbers like zero, infinity and a bunch of NaNs. There are also subnormal numbers; where numbers below 2^-127 are approximated with fixed instead of a floating exponent.
Actually, zero is a normal subnormal number. Subnormals are encoded with as (−1)signbits×2^−126 × 0.significandbits
and exponent all zero. If significantbits is zero, the result is (+/-) zero.
这篇关于数字0在二进制浮点格式中看起来如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!