[Rd] Inaccurate result for 0. (PR#13538)
Wacek Kusnierczyk
Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Thu Feb 19 12:30:44 CET 2009
Gábor Csárdi wrote:
> Hmmm, the favorite.
>
> http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f
>
hmm, an interesting quote:
"
To quote from “The Elements of Programming Style” by Kernighan and Plauger:
/10.0 times 0.1 is hardly ever 1.0/.
"
so here's one example where 10.0 times 0.1 *is* 1.0:
perl -Mbignum -le 'print (10.0 * 0.1 == 1.0)'
# 1, for true
not an isolated idiosyncrazy, for that matter.
vQ
More information about the R-devel
mailing list