Re: [R] Floating point imprecision in sum() under R-2.3.1?

From: Brahm, David <>
Date: Sat 19 Aug 2006 - 06:04:53 EST

I was concerned by this result (new in R-2.3.1): R> x <- c(721.077, 592.291, 372.208, 381.182) R> sum(x) - 2066.758

   [1] 4.547474e-13

But after Roger Peng's <> insightful comment that the relative difference (sum(x)/2066.758 - 1) is exactly what is expected, I'm convinced that sum() is indeed really being "more accurate" than it was in 2.2.1, i.e. accurately preserving the numerical imprecision of the original inputs. Sorry for the distraction... mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Sat Aug 19 06:22:31 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 19 Aug 2006 - 10:20:39 EST.

Mailing list information is available at Please read the posting guide before posting to the list.