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

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Tue 19 Dec 2006 - 22:16:16 GMT

On Tue, 19 Dec 2006, Duncan Murdoch wrote:

> On 12/19/2006 4:16 PM, Benjamin Tyner wrote:
>> 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?
>
> Force the value to be stored to a "double" and it will get the reduced
> precision. You can do this by assigning it to a numeric variable in R
> and then passing it back; you can presumably do it by some trickery in
> your compiler, but watch out for optimizations that leave it in an 80
> bit register the whole time.

In C, declaring a value as 'volatile' should force it to be stored in a 64-bit memory location. There is no known way to do this in Fortran: compilers and numeric software have been playing leapfrog games for years. What you can do with gcc (the compiler collection) is to compile a module with -ffloat-store, as we do with dlamc.f.

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Dec 20 09:24:08 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 - 13:31:00 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.