Why this simple expression is resulting in the wrong value

Viewed 53

How is this expression TRUE?

(13532728 + 1 + 76561197960265728) == (13532740 + 1 + 76561197960265728)

I calculated both expressions separated and they result in the same value:

Both: (13532728 + 1 + 76561197960265728) and (13532740 + 1 + 76561197960265728) are resultin in the same value:76561197973798464 in my R workspace. Which is clearly wrong, only the first number changes in both sides.

I thought it could be an overflow error. But isn't the max value of numeric .Machine$double.xmax which is huge.

Anyone can explain me why the calculation is wrong in R ?

0 Answers
Related