Open jaydeepbhayani opened 4 months ago
Wolfram Alpha says that the result should be 2728?
If I'm not mistaken (which might be, am tired) then your code comes out as:
((0.341 / 100.0) * 8000.0) / (1 - ((1 + (341.0 / 100.0)) ^ -84))
which results in 27.28
.
Having said that, both expressions are correctly evaluated by exp4j (0.4.8):
(0.341 * 8000.0) / (1 - (1 + 0.341) ^ -84) = 2728
((0.341 / 100.0) * 8000.0) / (1 - ((1 + (341.0 / 100.0)) ^ -84)) = 27.28
I get the exact same result from the "bc" linux utility:
~/dev/repos/dev story-ss-312…enkins-build *2 ?1 bc -lq ✔ 2 task 15:44:15
>>> (0.341 * 8000.0) / (1 - (1 + 0.341) ^ -84)
2728.00000005392957854258
>>> ((0.341 / 100.0) * 8000.0) / (1 - ((1 + (341.0 / 100.0)) ^ -84))
27.28000000000000000000
>>>
exp4j is evaluating correctly the expression.
I have an expression like this -> "(0.341 * 8000.0) / (1 - (1 + 0.341) ^ -84)"
Expected result - "109.71908469357446" Actual result - "1.538906384258725e-36"
calculation should be done like below snippet