OscarZ

About Float32 and Float64

 

Any number should be represented in the form of the formula above:

  (-1)^s: s is the sign bit

  M:  M is the fraction bit

  E: is the exponential bit

 

1. Float32

Float32 has 1 bit for s, 8 bits for E, and 23 bits for M

Example: For 5.0 in decimal, it is 101 in binary, so we can write it as 1.01 * 2^2, thus s=0, M=1.01, E=2

Example:

Float32 of 3

Float32 of 5

 

2.Float64

Float64 has 1 bit for s, 11 bits for E, and 52 bits for M

 

 

 

Reference:

https://www.binaryconvert.com/result_float.html?decimal=053

https://www.runoob.com/w3cnote/32-float-storage.html

https://www.cnblogs.com/zhibei/p/13255701.html

posted on 2020-10-14 16:56  OscarZ  阅读(106)  评论(0编辑  收藏  举报

导航