Re: [Rd] Standalone Mathlib, C++ and ISNAN()

2005-01-08 Thread Thomas Lumley
A review: The C++ math header undefines isnan, so if isnan is a macro, ISNAN() will not work in C++ code. C99 specifies that isnan is a macro, but in C90 compilers, where it is an extension, isnan is often a function (explaining why the issue didn't come up earlier). For example, isnan is a

Re: [Rd] Standalone Mathlib, C++ and ISNAN()

2005-01-06 Thread Bill Northcott
On 06/01/2005, at 3:31 PM, John W. Eaton wrote: What I finally decided to do for Octave was to use a C language autoconf test for isnan, then provide a function declared extern C that is a wrapper around the C isnan function (if it exists). I also use this method for other functions that may be

Re: [Rd] Standalone Mathlib, C++ and ISNAN()

2005-01-06 Thread Martyn Plummer
On Thu, 2005-01-06 at 08:29 +1100, Bill Northcott wrote: On 06/01/2005, at 6:53 AM, Thomas Lumley wrote: I believe (with a little Googling) the suggested C++ approach is to use std::isnan if cmath is included. I tried that too, but without any success. I even tried __gnu_cxx::isnan.

Re: [Rd] Standalone Mathlib, C++ and ISNAN()

2005-01-05 Thread Thomas Lumley
On Wed, 5 Jan 2005, Bill Northcott wrote: If building against a full R library, one might possible use R_IsNaN instead but this function is not included in libRmath v2.0 and the function R_IsNaNorNA which was used in libRmath v1.9 no longer exists Yes, but in your standalone C or C++ code you

Re: [Rd] Standalone Mathlib, C++ and ISNAN()

2005-01-05 Thread Bill Northcott
On 06/01/2005, at 3:09 AM, Thomas Lumley wrote: If building against a full R library, one might possible use R_IsNaN instead but this function is not included in libRmath v2.0 and the function R_IsNaNorNA which was used in libRmath v1.9 no longer exists Yes, but in your standalone C or C++ code

Re: [Rd] Standalone Mathlib, C++ and ISNAN()

2005-01-05 Thread Thomas Lumley
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

Re: [Rd] Standalone Mathlib, C++ and ISNAN()

2005-01-05 Thread Thomas Lumley
On Thu, 6 Jan 2005, Bill Northcott wrote: On 06/01/2005, at 6:53 AM, Thomas Lumley wrote: I believe (with a little Googling) the suggested C++ approach is to use std::isnan if cmath is included. I tried that too, but without any success. I even tried __gnu_cxx::isnan. It was suggested by one of

Re: [Rd] Standalone Mathlib, C++ and ISNAN()

2005-01-05 Thread Bill Northcott
On 06/01/2005, at 9:12 AM, Thomas Lumley wrote: It was suggested by one of the gcc people, but I could find no documentation about it. The ISO C++ docs do not include isnan as a symbol provided by cmath within the std namespace. I looked at the gcc source code and could see no reason why it

Re: [Rd] Standalone Mathlib, C++ and ISNAN()

2005-01-05 Thread John W. Eaton
On 6-Jan-2005, Bill Northcott [EMAIL PROTECTED] wrote: | On 06/01/2005, at 9:12 AM, Thomas Lumley wrote: | It was suggested by one of the gcc people, but I could find no | documentation about it. The ISO C++ docs do not include isnan as a | symbol provided by cmath within the std