-
Notifications
You must be signed in to change notification settings - Fork 82
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
Handle decimal/money arithmetic #70
Comments
Thanks. You can Override the == Operator and use a small delta for comparing float64 zu each other. If you want you can make a push request for |
Thanks @generikvault, I've now pushed a pull request that fixes this issue. I've tested it both in the gval repo and in my code base which is using this code and can confirm that this handles decimal arithmetic and logic appropriately. |
This library is fantastic!
The one issue I've found is that the Arithmetic is done as floating point numbers (which is fine for that use case) but this falls short when doing math involving decimals.
An example:
This results in this output:
When inspecting the variable values, I can see that
result
has the actual value of156.82500000000002
.Do you have any suggestions for what I should do, or is this even a solvable problem?
I was thinking that there could be an
EvaluateDecimal
method, which instead of treating numbers as floats, would treat them as a decimal type? For decimals, I usegithub.com/shopspring/decimal
.The text was updated successfully, but these errors were encountered: