Why does the following code not return zero?
sum(c(-2.8, -1.8, -0.8, 1.2, 4.2))
2.220446e-16
It returns an extremely small value, but the answer is clearly zero, not close to zero. Why does this happen and How to deal with this problem?
Why does the following code not return zero?
sum(c(-2.8, -1.8, -0.8, 1.2, 4.2))
2.220446e-16
It returns an extremely small value, but the answer is clearly zero, not close to zero. Why does this happen and How to deal with this problem?