Skip to content

Inaccurate result for 0. (PR#13538)

5 messages · Attila Lengyel, Gábor Csárdi, Brian Ripley +2 more

#
Full_Name: Attila Lengyel
Version: 2.8.0
OS: WinXP
Submission from: (NULL) (81.182.224.160)
[1] 2.775558e-17
#
Hmmm, the favorite.

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f

G.
On Wed, Feb 18, 2009 at 9:15 PM, <lengyel.at at gmail.com> wrote:

  
    
#
FAQ 7.31
On Wed, 18 Feb 2009, lengyel.at at gmail.com wrote:

            

  
    
#
On 18/02/2009 3:15 PM, lengyel.at at gmail.com wrote:
This is not a bug, it's FAQ 7.31.

Duncan Murdoch
#
G?bor Cs?rdi wrote:
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