Floating-point: “The leading 1 is 'implicit' in the significand.” — …huh?

后端 未结 3 1088
忘掉有多难
忘掉有多难 2020-12-25 14:29

I\'m learning about the representation of floating-point IEEE 754 numbers, and my textbook says:

To pack even more bits into the significand, IEEE 754

相关标签:
3条回答
  • 2020-12-25 14:42

    It may also be helpful to note that we are dealing in binary representations of a number. The reason that the first digit of a normalized binary number (that is, no leading zeroes) has to be 1 is that 1 is the only non-zero value available to us in this representation. So, the same would not be true for, say, base-three representations.

    0 讨论(0)
  • 2020-12-25 14:59

    Here is what they are saying. The first non-zero bit is always going to be 1. So there is no need for the binary representation to include that bit, since you know what it is. So they don't. They tell you where that first 1 is, and then they give the bits after it. So there is a 1 that is not explicitly in the binary representation, whose location is implicit from the fact that they told you where it was.

    0 讨论(0)
  • 2020-12-25 15:07

    Yes, all normalised numbers (other than the zeroes) have that bit set to one (a), so they make it implicit to prevent wasting space storing it.

    In other words, they save that bit totally, and reuse it so that it can be used to increase the precision of your numbers.

    Keep in mind that this is the first bit of the fraction, not the first bit of the binary pattern. The first bit of the binary pattern is the sign, followed by a few bits of exponent, followed by the fraction itself.

    For example, a single precision number is (sign, exponent, fraction):

    <1>  <--8--->  <---------23---------->  <- bit widths
     s   eeeeeeee  fffffffffffffffffffffff
    

    If you look at the way the number is calculated, it's:

    (-1)sign x 1.fraction x 2exponent-bias

    So the fractional part used for calculating that value is 1.fffff...fff (in binary).


    (a) There is actually a class of numbers (the denormalised ones and the zeroes) for which that property does not hold true. These numbers all have a biased exponent of zero but the vast majority of numbers follow the rule.

    0 讨论(0)
提交回复
热议问题