Home > Back-end >  Float mantissa only 23 can precisely 24 maximum number is 16777215. The ultimate precision less than
Float mantissa only 23 can precisely 24 maximum number is 16777215. The ultimate precision less than

Time:11-25

If I assign a 23 index greater than 16777215 how to undo the decimal number? More than 23 at the back of the tail 1 s and 0 s how to choose?

CodePudding user response:

https://www.cnblogs.com/fengliu-/p/7455246.html
Suggest to understand the ~

CodePudding user response:

See my question in reply, I do not want you to tell me how single precision is stored, my question is if the mantissa is beyond how to convert decimal after 23 for example, I define a binary is 1.00000000000000000000011 * 24 float016777219 mantissa has 24 beyond mantissa said, the result is 16777220 is why my question is if after more than 23 index such as index of 25 how to restore a decimal

CodePudding user response:

The custom want to data types, overloading need to calculation,

CodePudding user response:

Large range of floating-point Numbers is said, but the precision is not high, with 23 binary precision decimal precision is 6-7, more than the precision will be lost

F=16777219.0

E=log (f)/log (2)
E=0 + (e | 0)

M=(1 & lt; <23)
N=(2, e) - (f/pow 1.0)
N=n * m
N=((n + 0.5) | 0)//round here, precision loss

H=0 | ((e + 0 x7f) & lt; <23) | n//here is the hexadecimal stored data

V=h& (m - 1)
V=(v + 0.0)/m
F=(1.0 + v) * pow (2 e)//the end result here into 16777220



The following is a calculation steps:
 
F=16777219.00000000
16777219.00000000
E=log (f)/log (2)
E=16.63553251225261/log (2)
E=16.63553251225261/0.6931471805599453
E=24.00000025797396
24.00000025797396
E=0 + (e | 0)
E=0 + 0 x0000000000000018
E=24
24
M=(1 & lt; <23)
M=0 x0000000000800000
0 x0000000000800000
N=(2, e) - (f/pow 1.000000000000000)
N=(f/16777216.00000000-1.000000000000000)
N=(1.000000178813934 1.000000000000000)
N=1.788139343261719 e-007
1.788139343261719 e-007
N=n * m
N=1.500000000000000
1.500000000000000
N=((n + 0.5000000000000000) | 0)
N=(2.000000000000000 | 0)
N=0 x0000000000000002
0 x0000000000000002
H=0 | ((e + 0 x000000000000007f) & lt; <23) | n
H=0 | (151 & lt; <23) | n
H=0 | 0 x000000004b800000 | n
H=0 x000000004b800000 | n
H=0 x000000004b800002
0 x000000004b800002
V=h & amp; (m - 1)
V=h & amp; 0 x00000000007fffff
V=0 x0000000000000002
0 x0000000000000002
V=(v + 0.0000000000000000)/m
V=2.000000000000000/m
V=2.384185791015625 e-007
2.384185791015625 e-007
F=(1.000000000000000 + v) * pow (2 e)
(f=1.000000238418579 * pow, 2 e)
F=1.000000238418579 * 16777216.00000000
F=16777220.00000000
16777220.00000000

  • Related