Re: [R] bug when subtracting decimals?

2009-04-22 Thread Martin Maechler
> "MS" == Marc Schwartz > on Tue, 21 Apr 2009 08:06:46 -0500 writes: MS> On Apr 21, 2009, at 5:55 AM, Duncan Murdoch wrote: >> On 21/04/2009 3:48 AM, Petr PIKAL wrote: >>> Hi >>> r-help-boun...@r-project.org napsal dne 20.04.2009 19:01:46: wolfgang.siewert gm

Re: [R] bug when subtracting decimals?

2009-04-21 Thread Sarah Goslee
I'd be happy if everyone made a minimal effort to solve their problems before posting. There may be 130 pages of printed FAQs, but the html file is fully searchable. It would be easier to browse with a good ToC, but it's not that overwhelming to _look to see if there's a FAQ related to your problem

Re: [R] bug when subtracting decimals?

2009-04-21 Thread hadley wickham
> "Have you read the posting guide and the FAQs? If you do not get a reply > within two days, you may want to look at both and think about reformulating > your query. Oh, and while you are at it, look through the archives, a lot of > questions have already been asked and answered before." As I say

Re: [R] bug when subtracting decimals?

2009-04-21 Thread John C Nash
A quarter-century ago I was part of the IEEE 854 group that tried to suggest a radix free arithmetic standard. One of the interests was decimal arithmetic. I actually have owned 2 decimal arithmetic computers, a North Star Horizon (with decimal hardware I had to build by hand from a kit) and a R

Re: [R] bug when subtracting decimals?

2009-04-21 Thread ivan valencia
try this > 0.3-0.1 == 0.2 [1] FALSE > round(0.3-0.1,1)==round(0.2,1) [1] TRUE liov 2009/4/21 Marc Schwartz > On Apr 21, 2009, at 5:55 AM, Duncan Murdoch wrote: > > On 21/04/2009 3:48 AM, Petr PIKAL wrote: >> >>> Hi >>> r-help-boun...@r-project.org napsal dne 20.04.2009 19:01:46: >>> wolf

Re: [R] bug when subtracting decimals?

2009-04-21 Thread Marc Schwartz
On Apr 21, 2009, at 5:55 AM, Duncan Murdoch wrote: On 21/04/2009 3:48 AM, Petr PIKAL wrote: Hi r-help-boun...@r-project.org napsal dne 20.04.2009 19:01:46: wolfgang.siewert gmail.com> writes: There is a way around: round(0.7-0.3,1)==0.4 (TRUE) Obviously there is a problem with some combina

Re: [R] bug when subtracting decimals?

2009-04-21 Thread Duncan Murdoch
On 21/04/2009 3:48 AM, Petr PIKAL wrote: Hi r-help-boun...@r-project.org napsal dne 20.04.2009 19:01:46: wolfgang.siewert gmail.com> writes: 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 t

Re: [R] bug when subtracting decimals?

2009-04-21 Thread Petr PIKAL
r-help-boun...@r-project.org napsal dne 21.04.2009 10:00:06: > Petr PIKAL precheza.cz> writes: > > > Maybe that is because of Excel is so widespread now and gives expected > > results (it probably silently rounds all decimal numbers before > > calculation). > > Marc Schwartz already reminde

Re: [R] bug when subtracting decimals?

2009-04-21 Thread Dieter Menne
Petr PIKAL precheza.cz> writes: > Maybe that is because of Excel is so widespread now and gives expected > results (it probably silently rounds all decimal numbers before > calculation). Marc Schwartz already reminded me of that one, and it's a good point to explicitly mention in lectures.

Re: [R] bug when subtracting decimals?

2009-04-21 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 20.04.2009 19:01:46: > wolfgang.siewert gmail.com> writes: > > > 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 - should

Re: [R] bug when subtracting decimals?

2009-04-20 Thread Stephan Kolassa
Hi, Gavin Simpson wrote: I bemoan the apparent inability of those asking such questions to use the resources provided to solve these problems for themselves... Looking at all the people who quite obviously do NOT "read the posting guide and provide commented, minimal, self-contained, reprod

Re: [R] bug when subtracting decimals?

2009-04-20 Thread Gavin Simpson
Dieter Menne wrote: wolfgang.siewert gmail.com> writes: 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. Oh no, not that one again! This was lecture two in my fir

Re: [R] bug when subtracting decimals?

2009-04-20 Thread Dieter Menne
wolfgang.siewert gmail.com> writes: > 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. Oh no, not that one again! This was lecture two in my first computer

Re: [R] bug when subtracting decimals?

2009-04-20 Thread Dimitris Rizopoulos
this is a (very) Frequently Asked Question; check: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f Best, Dimitris wolfgang.siewert 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 (F

Re: [R] bug when subtracting decimals?

2009-04-20 Thread Henrique Dallazuanna
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

[R] bug when subtracting decimals?

2009-04-20 Thread wolfgang.siewert
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 solv