Floating-Point Precision Error in Expression Evaluation
Describe the Bug
When using the feelin to evaluate the expression "1.1 + 1.3", the result is unexpectedly "2.4000000000000004" instead of "2.4". This appears to be a floating-point precision issue.
Steps to Reproduce
- visit playground
- Observe the result
Expected Behavior
The expected result of the expression "1.1 + 1.3" should be "2.4", without any additional decimal places caused by floating-point precision errors.
Environment
- Library version: 4.3.0
Thanks for reporting this issue. This is a standard behavior of JavaScript, the environment the interpretation happens.
What is the impact of this error?
I agree, this is a well-known floating-point issue in JavaScript. We are using this library to provide a preview of Camunda calculations in our backend. Unfortunately, the discrepancies in calculation results make it unusable for our use case, as the preview doesn’t match the actual Camunda outputs.
Whether this is a bug or not, I cannot judge from my perspective.
We are using this library to provide a preview of Camunda calculations in our backend.
If you want to preview Camunda calculations, why not embed / call feel-scala directly. Use the environment that is closest to actual execution.
I'll leave this issue open for future reference, but as said, this is a limitation of the underlying platform that I'll likely not workaround.