Closed devnev0 closed 4 years ago
Yeah, read up about floating-point precision. In short, float
and double
is, mostly, an approximation of values.
Yes I think too. It's bad me. Using Double is not a good thing in my app. Do you know an alternative with this lib or other?
There is EvalEx which is similar and uses BigDecimal
s...and before you ask look at EvalEx#114.
Thank you. I try it.
I don't know if it's a bug but I don't understand why exp4j gives this result. 249 * 0.595 = 249.305
BigDecimal.valueOf(419).multiply(BigDecimal.valueOf(0.595));
This give 249.305 too. I wait same with exp4jNow with exp4j:
new ExpressionBuilder(regle).variable("d").variables("d").build().setVariable("d", 419).evaluate();
I obtain 249.30499999999998.Do you know what is wrong?