From pdalgd at gmail.com  Fri Jan 27 14:42:09 2012
From: pdalgd at gmail.com (peter dalgaard)
Date: Fri, 27 Jan 2012 14:42:09 +0100
Subject: [Rd] Numerical instability in new R Windows development version
In-Reply-To: <CAML4n3MNRsp_kTpPHarDh7_kLCVwGZJkweOxkoo6S8OMwENfjg@mail.gmail.com>
References: <CAML4n3MNRsp_kTpPHarDh7_kLCVwGZJkweOxkoo6S8OMwENfjg@mail.gmail.com>
Message-ID: <68DCB1CC-FD34-4B33-9C7F-94FE1B054E2F@gmail.com>


On Jan 27, 2012, at 13:23 , Hans W Borchers wrote:

>  (1 - (x^2 + y^2)) * (x^2 + y^2 <= 1)
> 
> It appears to be an often used trick in numerical analysis. One advantage is
> that a function using it is immediately vectorized while an expression such
> as, e.g., "max(0, 1 - (x^2 + y^2))" is not.

However, "pmax(0, 1 - (x^2 + y^2))" is (unless 0-length x,y is an issue). 

But of course, Duncan is right: It is a bug if you can't take the square root of negative zero.

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



[Rd] Numerical instability in new R Windows development version
peter dalgaard