Best Practices for Handling Floating-Point Precision in Financial Applications #7327
Closed
kenshin101
started this conversation in
General
Replies: 1 comment
-
|
The recommended approach is to avoid floating point arithmetic for financial data and instead use decimal-based libraries or integer representations. from decimal import Decimal a = Decimal("0.1") |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
Expected result: 0.3
print(0.1 + 0.2)
Actual result: 0.30000000000000004
Beta Was this translation helpful? Give feedback.
All reactions