R is getting a very simple subtraction wrong:
> 4.04 - 4.02
[1] 0.02
> 4.04 - 4.02 == 0.02
[1] FALSE
> 4.04 - 4.02 > 0.02
[1] TRUE
4.04 minus 4.02 gets me something close to, but greater than, 0.02. Similar operations sometimes yield the correct result:
> 0.04 - 0.02 == 0.02
[1] TRUE
> 4.51 - 4.01 == 0.5
[1] TRUE
And sometimes not:
> 0.98 - 0.96 == 0.02
[1] FALSE
> 0.98 - 0.96 > 0.02
[1] TRUE
> 4.1 - 4 == 0.1
[1] FALSE
> 4.1 - 4 < 0.1 # this one is getting something lower, not greater, than 0.1
[1] TRUE
Any clue on what might be going on here? I'm using R version 4.2.0 on macOS 12.4 (freshly updated from 4.1.1 and 11.6.5 in the hope of solving the problem, but it persisted).
EDIT
Just tried the same operations in Excel and the problem is also there, meaning it's not restricted to R.
4.04 - 4.02 yields 0.0200000000000005.
4.1 - 4 results in 0.0999999999999996.
Guess I should get in touch with Apple Support...