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

2005-01-08 Thread Thomas Lumley
On Sun, 9 Jan 2005, Bill Northcott wrote: Does this mean the changes will be in the current daily builds? I presume the function involved is now in the standalone Rmath build. The function is available for the standalone Rmath library and also linking to R. I'm not sure when the daily snapshot ge

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

2005-01-08 Thread Bill Northcott
On 09/01/2005, at 9:11 AM, Thomas Lumley wrote: 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

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 mac

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

2005-01-06 Thread Bill Northcott
On 06/01/2005, at 10:16 PM, Martyn Plummer wrote: I think the workaround is supposed to look like this: #define _GLIBCPP_USE_C99 1 #include #undef _GLIBCPP_USE_C99 #include using __gnu_cxx::isnan; I thought I had tried that, but I was not sure. So I tried again this morming, and it definitely d

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 is included. > > > I tried that too, but without any success. I even tried > __gnu_cxx::is

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-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 na

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 sh

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 is included. I tried that too, but without any success. I even tried __gnu_cxx::isnan. It was suggested by one of the g

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

2005-01-05 Thread Bill Northcott
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 is included. I tried that too, but without any success. I even tried __gnu_cxx::isnan. It was suggested by one of the gcc people, but I could find no document

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 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 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 ca

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

2005-01-04 Thread Bill Northcott
In the hope of some meaningful response and ignoring the risk of further abuse, let me try to clarify the issue here. I have re-read the 'Writing R Extensions' manual. It seems to me that it clearly says R API functions can be called from from C++ programs, and the API includes the special va