From ripley at stats.ox.ac.uk  Tue Dec 19 23:16:16 2006
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 19 Dec 2006 22:16:16 +0000 (GMT)
Subject: [Rd] precision when calling a C function;
 presence of Fortran call
In-Reply-To: <4588589A.8020102@stats.uwo.ca>
References: <4588363A.5050305@stat.purdue.edu> <45883BB5.5050806@stats.uwo.ca>
	<458856C1.3080600@stat.purdue.edu> <4588589A.8020102@stats.uwo.ca>
Message-ID: <Pine.LNX.4.64.0612192212010.15148@gannet.stats.ox.ac.uk>

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



[Rd] precision when calling a C function; presence of Fortran call
Prof Brian Ripley