-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Float32 accuracy issue #14497
Comments
Maybe consider opening an issue at IEEE_754? ;) |
@Macfly to expound a bit on Ritchie's answer, numbers are stored in the computer in binary format with a limited number of bits, and so we cannot represent all numbers exactly. If you take a look at https://www.omnicalculator.com/other/floating-point and select |
I understand the floating accuracy but why with Numpy and Pandas, it is displayed as 799.32 with float32. |
numpy does the same thing actually >>> pl.Series([799.32], dtype=pl.Float32).item()
799.3200073242188
>>> np.float32(799.32).item()
799.3200073242188
>>> np.float32(799.32).astype(np.float64)
799.3200073242188 when you do >>> np.float64(799.32).astype(np.float32).astype(np.float64).item()
799.3200073242188 you start with a 64-bit Python |
Checks
Reproducible example
Log output
No response
Issue description
it prints 799.3200073242188
Expected behavior
Expecting 799.32 (like with the type pl.Float64)
Installed versions
The text was updated successfully, but these errors were encountered: