In binary notation, what is the meaning of the digits after the radix point “.”?

后端 未结 7 548
感情败类
感情败类 2020-12-28 13:22

I have this example on how to convert from a base 10 number to IEEE 754 float representation

Number: 45.25 (base 10) = 101101.01 (base 2) Sign: 0
Normalized          


        
7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-28 14:10

    You can think of 0.25 as 1/4.

    Dividing by 2 in (base 2) moves the decimal point one step left, the same way dividing by 10 in (base 10) moves the decimal point one step left. Generally dividing by M in (base M) moves the decimal point one step left.

    so

    base 10                  base 2
    --------------------------------------
    1                      =>      1
    1/2 = 0.5              =>    0.1
    0.5/2 = 1/4 = 0.25     =>   0.01 
    0.25/2 = 1/8 = 0.125   =>  0.001
    .
    .
    .
    

    etc.

提交回复
热议问题