Closed LucasLongarini closed 2 days ago
Hi @LucasLongarini, this is expected as the given number cannot be represented as a decimal.
We use rust_decimal for number representation. This was done intentionally in order to properly serve domains where precision loss during calculation is not acceptable (think fintech, insurance, regulatory compliance, etc.).
To give you better idea, as example on Node.js (because it follows IEEE-754):
0.1 + 0.2 = 0.30000000000000004
Is there any specific use case that you have where floating point calculations are needed and cannot be served by rounding above number to 0.0000001
?
Thanks for the explanation. Yeah in our case we were taking a percentage output from a ML model which could end up being very small. We did just end up rounding.
We recently discovered that using a decimal value smaller than
0.0000009999999999999999
causes the evaluate function to throw withHook timed out
. To reproduce this, run a rule file with the example input:Platform: Node 20