feelin icon indicating copy to clipboard operation
feelin copied to clipboard

Floating-Point Precision Error in Expression Evaluation

Open Anyman552 opened this issue 7 months ago • 3 comments

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

  1. visit playground
  2. 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

Anyman552 avatar May 14 '25 07:05 Anyman552

Thanks for reporting this issue. This is a standard behavior of JavaScript, the environment the interpretation happens.

What is the impact of this error?

nikku avatar Oct 03 '25 08:10 nikku

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.

Anyman552 avatar Oct 22 '25 07:10 Anyman552

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.

nikku avatar Oct 29 '25 12:10 nikku