This is a FAQ. Try this:
all.equal(0.7-0.3, 0.4) On Mon, Apr 20, 2009 at 10:07 AM, wolfgang.siewert < wolfgang.siew...@gmail.com> wrote: > > Try this: > > 0.7-0.3==0.4 > (We get FALSE) > 0.7-0.3<0.4 > (We get TRUE) > > but > 0.8-0.3==0.5 > (TRUE) > 0.8-0.3<0.5 > (FALSE) > > Funny, he? > > There is a way around: > round(0.7-0.3,1)==0.4 > (TRUE) > > Obviously there is a problem with some combinations of decimal > subtractions, > that - we have the feeling - shouldt be solved. > > Best regards > Sven & Wolfgang > -- > View this message in context: > http://www.nabble.com/bug-when-subtracting-decimals--tp23136337p23136337.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ 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.