I've got a weird case using Python to get the result of this calculation:
11.66 * 0.98 * 1.05 + 1.7 + 0.70 * 1.03
in Python the result that I got is 14.41914
but when my customer calculate it using their calculator and iPhone the result that they got is 14.8300842
so which is the correct result ? and what caused this calculation to have different result ? thanks
The correct result is the one Python gave you. Your customer is using a calculator that doesn't account for order of operations, or has used the calculator in such a way that order of operations information was discarded.
What your customer seems to have done is this:
>>> (11.66*0.98*1.05 + (1.7+0.7))*1.03
14.830084200000002
>>>
whereas that expression in python:
>>> 11.66*0.98*1.05 + 1.7+0.7*1.03
14.419140000000001
Does the multiplies first:
>>> (11.66*0.98*1.05) + 1.7+(0.7*1.03)
14.419140000000001
Its a very strong convention that multiplication is done first, but desk calculators (real and appy) have to work on the numbers as they are punched in, so might do different things.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With