[Rd] Numerical instability in new R Windows development version

peter dalgaard pdalgd at gmail.com
Fri Jan 27 14:42:09 CET 2012

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

More information about the R-devel mailing list