Re: [R] Cannot call R's ISNAN() from a C code in >1.7 versions.

About this list Date view Thread view Subject view Author view Attachment view

From: Prof Brian Ripley (
Date: Tue 25 May 2004 - 05:07:01 EST

Message-id: <Pine.LNX.4.44.0405241948440.31140-100000@gannet.stats>

On Mon, 24 May 2004, Paul Y. Peng wrote:

> Prof Brian Ripley wrote:
> > First, there are no versions 1.7, 1.8 and 1.9.
> Sorry for my misuse of the version numbers.
> > Was your version of R compiled against MSVC++ 6.0? The binary on CRAN was
> > not, and binaries for different versions of R were compiled with different
> > versions of MinGW. The entry point isnan is part of the statically linked
> > runtime on modern MinGW.
> I used the binary on CRAN.

Then please use the compilers described in readme.packages which match it.

> > MSVC++ 6.0 does supply _isnan (as it really should as it is part of the
> > C99 ISO standard), and you need to link against it appropriately. Hint:
> > it may have an extra underline, since it seems it is known to C as _isnan.
> > You may need to add
> >
> > #undef ISNAN
> > #define ISNAN(x) _isnan(x)
> Many thanks for this suggestion. It works, as always. The extra
> underline is required.
> > We don't support adding extensions to R using a different compiler to the
> > one used to build R. Changes already made for future releases of R will
> > make this less likely to work in R 2.0.x.
> I wish that the R API entry points documented in "Writing R Extensions"
> be supported in the future versions of R, because it will make programs
> built with R more portable than directly using compiler-specific
> functions, such as testing and generating the IEEE 754 special values.
> The existing entry points have saved me trouble to chase these values
> whenever I moved to an environment with a different compiler.

Who said they would not supported? What I said is that using a different
compilers to compile different parts of R is not supported (and never has
been). And that is even less likely to work in future releases. All we
guarantee is that ISNAN and R_FINITE produce calls to functions that work
under the system used to configure R. As on Windows R_FINITE now produces
a call to a MinGW macro, that is not going to work under VC++ 6.

We are not talking about using `compiler-specific functions' here, like
_isnan. What R core is doing is using *standard* C99 functions where
available, and a problem with VC++ 6.0 is that it is far from compliant
with IEC60559 aka IEEE754. Given that the recommended compiler is freely
available, it is unreasonable to expect any support for less capable

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list PLEASE do read the posting guide!

About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:12 EST