Re: [R] numeric comparison error

2018-06-18 Thread MacQueen, Don via R-help
What Jeff, said, plus to see it explicitly: > print(cpgbins[5:7], digits=18) [1] 0.200011 0.25 0.300044 > print(c(0.2, 0.25, 0.3), digits=18) [1] 0.200011 0.25 0.299989 -Don -- Don MacQueen Lawrence Livermore Nation

Re: [R] numeric comparison error

2018-06-18 Thread Bert Gunter
FAQ 7.31. Binary arithmetic. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Jun 18, 2018 at 2:45 PM, Brian Smith wrote: > Hi, > > I am a

Re: [R] numeric comparison error

2018-06-18 Thread Jeff Newmiller
FAQ 7.31, or take a university course in numerical analysis. https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f On June 18, 2018 2:45:29 PM PDT, Brian Smith wrote: >Hi, > >I am a little bit perplexed at why I am getting some values as FALSE: > >> c

[R] numeric comparison error

2018-06-18 Thread Brian Smith
Hi, I am a little bit perplexed at why I am getting some values as FALSE: > cpgbins <- seq(0,1,0.05) > cpgbins [1] 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 > cpgbins[1] == 0.00 [1] TRUE > cpgbins[2] == 0.05 [1] TRUE > cpgbins[3] =