Re: [Rd] precision when calling a C function; presence of Fortran call

From: Benjamin Tyner <btyner_at_stat.purdue.edu>
Date: Tue 19 Dec 2006 - 21:16:49 GMT

Thanks; I'm on 32-bit linux, but it's good to know the behavior on Windows. Do you know a way to force "floor" to use this reduced precision?

Ben

Duncan Murdoch wrote:
> On Windows, it's fairly common for runtime libraries to switch the
> precision from 80 bit to 64 bit. R on Windows tries to guard against
> this, and on your test package, I get
>
> when f computed by R, C says 40 by itself
> when f computed by R, C says 40, Fortran says 40
> when f computed by C, C says 40 by itself
> when f computed by C, C says 40, Fortran says 40
>
> It's possible that the floating point change is happening on your
> platform, or happened before you even got to this call.
>
> Here's code that works in Windows to detect such a change across a
> LoadLibrary call:
>
> rcw = _controlfp(0,0) & ~_MCW_IC; /* Infinity control is ignored */
> _clearfp();
> tdlh = LoadLibrary(path);
> dllcw = _controlfp(0,0) & ~_MCW_IC;
>
> No idea if _controlfp() exists on your system.
>
> Duncan Murdoch



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Dec 21 05:25:55 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 20 Dec 2006 - 18:31:03 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.