0

I want to encode -(263.125) in base 10.
I encoded it and arrived at this solution :

11000011110000011100100000000000

I just want to make sure that it is correct.
Thank you in advance.

Mewtwo
  • 1,231
  • 2
  • 18
  • 38
P_M
  • 42
  • 6

1 Answers1

0

Not quite, assuming you're trying to convert to a 32-bit IEEE-754 single-precision floating-point number. The encoding you found corresponds to:

                  3  2          1         0
                  1 09876543 21098765432109876543210
                  S ---E8--- ----------F23----------
          Binary: 1 10000111 10000011100100000000000
             Hex: C3C1 C800
       Precision: SP
            Sign: Negative
        Exponent: 8 (Stored: 135, Bias: 127)
       Hex-float: -0x1.839p8
           Value: -387.5625 (NORMAL)

The correct encoding for -263.125 as a single-precision float is:

                  3  2          1         0
                  1 09876543 21098765432109876543210
                  S ---E8--- ----------F23----------
          Binary: 1 10000111 00000111001000000000000
             Hex: C383 9000
       Precision: SP
            Sign: Negative
        Exponent: 8 (Stored: 135, Bias: 127)
       Hex-float: -0x1.072p8
           Value: -263.125 (NORMAL)

So, you got the sign and the exponent correct; but your fraction is not quite right.

alias
  • 28,120
  • 2
  • 23
  • 40
  • But when you convert "263" into a binary number and to base 2, at the end of the division you will have a "1". – P_M Nov 20 '19 at 16:23
  • Perhaps you're getting confused by the "implicit 1"? See here: https://stackoverflow.com/questions/4930269/floating-point-the-leading-1-is-implicit-in-the-significand-huh – alias Nov 20 '19 at 16:35