0

I have two vectors:

parentvec<-c(1.4982, 18.18734, 901.14744)
childvec<-c(0.90268, 13.77532, 613.38298, 0.01845, 0.0681, 7.19925, 3.75315, 0.14333, 136.54008, 0.04766, 0.59077, 28.97255, 0.38608, 115.05258)

When I sum each of them, I get the same result:

> sum(childvec)
[1] 920.833

> sum(parentvec)
[1] 920.833

But when I subtract one from the other, I get a non-zero result:

> sum(childvec)-sum(parentvec)
[1] 1.136868e-13

What on earth is going on and how do I stop it?

In case this is relevant, I'm using Win10, with R 3.4.3.

iod
  • 7,412
  • 2
  • 17
  • 36

0 Answers0