Skip to content
Back to formatted view

Raw Message

Message-ID: <XFMail.030529000319.Ted.Harding@nessie.mcc.ac.uk>
Date: 2003-05-28T23:03:19Z
From: (Ted Harding)
Subject: Numbers that look equal, should be equal, but if() doesn
In-Reply-To: <3ED4DDB7.7020308@lancaster.ac.uk>

On 28-May-03 Barry Rowlingson wrote:
>   Oh, why not just go one step further, and redefine the == operator!
> 
>   "==" <- function(x,y){equal.enough(x,y)}
> 
> before:
>  > (.1+.2)==.3
> [1] FALSE
> 
> after:
>  > (.1+.2)==.3
> [1] TRUE
> 
>   This requires a slight modification to equal.enough, which I will not
> list here, so that people dont _actually_ do this. It just ensures that
> equal.enough doesn't go all infinitely recursive on us.
> 
>   Next time on useless R tips: 1 + 1 = 3

At which point I am unable to resist quoting:

  "2 plus 2 is never equal to 5 -- even for large values of 2".

Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 167 1972
Date: 29-May-03                                       Time: 00:03:19
------------------------------ XFMail ------------------------------