Why ruby and python math calculation are different

Viewed 240
2 + 2 / - 7 * - 7 * 8 - 5 + 7 * -3

Python calculates this expression like this:

2+2/-7*-7*8-5+7*-3 == -8.0
# True

And Ruby like this:

2+2/-7*-7*8-5+7*-3 == 32
# => true

But the correct answer is -8.

Where am I wrong? Why the Ruby result is different from the Python one?

3 Answers
Related