0
Follow
0
View

Question about #c++# : p2 is the same as p3

koala51004 注册会员
2023-01-25 18:03

This is because computers save floating-point numbers as something like a*(2^b), rather than base 10 as we intuitively think of them, or base 2 as they process them internally. That is, the number is converted into the 2-base "scientific counting method" form, and then the form is reversed into the decimal form. However, due to the limitation of the number of digits, some numbers are converted into binary counting form after the number exceeds the limit, so the excess bit will be truncated, and the number will be deviated from the original number when converted back. This deviation is different for different numbers. p2 and p3 are the same from a human point of view, but not from a computer.

dafeng2006 注册会员
2023-01-25 18:03

This involves the precision of the values

About the Author

Question Info

Publish Time
2023-01-25 18:03
Update Time
2023-01-25 18:03