Re: [R] Numbers that look equal, should be equal, but if() doesn'tsee as equal (repost with code included)

2003-05-29 Thread Thomas Lumley
On Wed, 28 May 2003, Paul Lemmens wrote: Hi! Apologies for sending the mail without any code. Apparently somewhere along the way the .R attachments got filtered out. I have included the code below as clean as possible. My original mail is below the code. I still think you need not to be

Re: [R] Numbers that look equal, should be equal, but if() doesn'tsee as equal (repost with code included)

2003-05-29 Thread Paul Lemmens
Hoi Thomas, --On woensdag 28 mei 2003 7:16 -0700 Thomas Lumley [EMAIL PROTECTED] wrote: On Wed, 28 May 2003, Paul Lemmens wrote: Hi! Apologies for sending the mail without any code. Apparently somewhere along the way the .R attachments got filtered out. I have included the code below as clean

Re: [R] Numbers that look equal, should be equal, but if() doesn'tsee as equal (repost with code included)

2003-05-29 Thread Prof Brian Ripley
On Wed, 28 May 2003, Paul Lemmens wrote: Hoi Thomas, --On woensdag 28 mei 2003 7:16 -0700 Thomas Lumley [EMAIL PROTECTED] wrote: On Wed, 28 May 2003, Paul Lemmens wrote: Hi! Apologies for sending the mail without any code. Apparently somewhere along the way the .R attachments

RE: [R] Numbers that look equal, should be equal,but if() doesn'tsee as equal (repost with code included)

2003-05-29 Thread Simon Fear
Try the following function (the name is supposed to be a joke, by the way), which will also do the right thing with NAs and characters. Use it as if(equal.enough(x,y)) rather than if(x==y), e.g. equal.enough(0.1+0.2, 0.3) [1] TRUE My default of 15 significant figures may be overkill in many

RE: [R] Numbers that look equal, should be equal,but if() doesn'tsee as equal (repost with code included)

2003-05-29 Thread Simon Fear
No problem, equal.enough(1+1,3,d.p.zero=10) ! But seriously, this is WHY NOT do that substitution: it helps me remember that I am not in fact truly testing for numeric identity. S -Original Message- From: Barry Rowlingson [mailto:[EMAIL PROTECTED] Sent: 28 May 2003 17:03 To: Simon