flowable / flowable/flowable-engine

precision loss of double/float value in dmn-engine

Open
#4,065 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.5k
Forks
2.9k
Avg merge
7h 8m
Merged PRs (30d)
2

Description

Description:
Using double/float input data to execute a dmn decision table, the double/float input got prevcision loss。

Version:
Flowable Version: 6.5.0

Code:
code snippet in ELExecutionContextBuilder.java

```
} else if (inputVariableValue instanceof Double ) {
BigDecimal transformedNumber = new BigDecimal((Double) inputVariableValue);
inputVariables.put(inputVariableName, transformedNumber);
} else if (inputVariableValue instanceof Float) {
double doubleValue = Double.parseDouble(inputVariableValue.toString());
BigDecimal transformedNumber = new BigDecimal(doubleValue);
inputVariables.put(inputVariableName, transformedNumber);
}
```

Additional comments:
i think the best way is using BigDecimal.valueOf(val) or new BigDecimal(Double.toString(val))

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.