From tlumley at u.washington.edu  Wed Jan  5 20:53:29 2005
From: tlumley at u.washington.edu (Thomas Lumley)
Date: Wed Jan  5 20:53:38 2005
Subject: [Rd] Standalone Mathlib, C++ and ISNAN()
In-Reply-To: <C2214FA4-5F4F-11D9-97FA-000393D3D676@unsw.edu.au>
References: <77B2A8C4-5ED8-11D9-97FA-000393D3D676@unsw.edu.au>
	<Pine.A41.4.61b.0501050759060.100170@homer05.u.washington.edu>
	<C2214FA4-5F4F-11D9-97FA-000393D3D676@unsw.edu.au>
Message-ID: <Pine.A41.4.61b.0501051149490.59084@homer03.u.washington.edu>

On Thu, 6 Jan 2005, Bill Northcott wrote:

> As I explained in the last message:
>>> In R2.0 ISNAN() is defined using isnan thus (isnan(x)!=0).  isnan() is in 
>>> math.h and this works perfectly for C code.  However, in C++ the header 
>>> cmath (included by iostream and others) undefs isnan().  So on platforms 
>>> for which isnan() is a macro, the code breaks at compile time with 
>>> 'isnan() undeclared'.

I believe (with a little Googling) the suggested C++ approach is to use 
std::isnan if <cmath> is included.


 	-thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley@u.washington.edu	University of Washington, Seattle


[Rd] Standalone Mathlib, C++ and ISNAN()
Thomas Lumley