[Rd] precision when calling a C function; presence of Fortran call
Prof Brian Ripley
ripley at stats.ox.ac.uk
Tue Dec 19 23:16:16 CET 2006
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 at 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
More information about the R-devel
mailing list