On Fri, 2010-07-02 at 21:23 -0700, Roger Deangelis wrote: > > Although it does not apply to your series and is impractical, it seems to > me that the most accurate algorithm might be to add all the rational numbers > whose sum and components can be represented without error in binary first, > ie 2.5 + .5 or 1/16 + 1/16 + 1/8. > > You could also get very clever and investigate a sum that should have an > exact binary representation when the individual components do not, ie .1 + > .2 + .2 = .5 and correct the sum. > > Roger
Roger I think you must read: What Every Computer Scientist Should Know About Floating-Point Arithmetic ( http://docs.sun.com/source/806-3568/ncg_goldberg.html ) I think your question and others like this question is answer in this paper -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.