Search code examples
floating-pointsingle-precision

Converting IEEE single precision to decimal


If S = 0, E = 01110011, and F = 100101

E would be 115 right? and if so would that make the exponent -12 ?

If the Bias is 127.


Solution

  • Here's how your number parses as a 32-bit SP IEEE-754 float:

                      3  2          1         0
                      1 09876543 21098765432109876543210
                      S ---E8--- ----------F23----------
              Binary: 0 01110011 10010100000000000000000
                 Hex: 39CA 0000
           Precision: SP
                Sign: Positive
            Exponent: -12 (Stored: 115, Bias: 127)
           Hex-float: +0x1.94p-12
               Value: +3.8528442e-4 (NORMAL)
    

    The stored exponent is 115, which coresponds to -12 with a bias of 127.