Replies: 1 comment 1 reply
-
|
This is because floating-point representation cannot precisely represent every decimal fraction. You're using single-precision here; you could get smaller error by using double precision floats ( |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
If i use this simple code:
The printed results are:
2.4
3.3
4.200001
Why does the 4.2 has the extra 00001 behind it? And how can i resolve this so it is exactly 4.2?
Beta Was this translation helpful? Give feedback.
All reactions