Skip to content
Back to formatted view

Raw Message

Message-ID: <5A80B9B4-39C5-11D9-B2EE-000393B3E9D0@utah.edu>
Date: 2004-11-19T00:52:57Z
From: Nathan Leon Pace, MD, MStat
Subject: Creating logical value from the difference of two absolute values
In-Reply-To: <5.2.1.1.0.20041118191436.00c353d0@biomserv.univ-lyon1.fr>

Hi,

Using R 2.0.1 on Mac g5 running Mac OS X 10.3.6.

I would expect that

abs(.7 - .5) >= abs(.3 - .5) should be returned TRUE.

Instead

 > www <- abs(.7 - .5) >= abs(.3 - .5)
 > www
[1] FALSE

Is this a result of floating point or the implementation of abs or 
something else?

In a function I need to compare two absolute values - each being of the 
form |variable - constant|.

Any suggestions for implementing this correctly?

Nathan