Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

几个浮点运算精度丢失的例子 #2037

Open
fisker opened this issue May 14, 2024 · 0 comments
Open

几个浮点运算精度丢失的例子 #2037

fisker opened this issue May 14, 2024 · 0 comments

Comments

@fisker
Copy link
Owner

fisker commented May 14, 2024

加法

0.1 + 0.2 // 0.30000000000000004
2.3 + 2.4 // 4.699999999999999

减法

1 - 0.9 // 0.09999999999999998
0.07 - 0.01 // 0.060000000000000005

乘法

0.09 * 10 // 0.8999999999999999
0.07 * 10 // 0.7000000000000001
0.362 * 100 // 36.199999999999996

除法

36.2 / 0.362 // 100.00000000000001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant