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

2006-12-19 Thread Benjamin Tyner
Thanks! It seems the 'volatile' declaration is exactly what was needed. Ben Prof Brian Ripley wrote: > 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 playin

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

2006-12-19 Thread Prof Brian Ripley
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 g

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

2006-12-19 Thread Duncan Murdoch
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 ass

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

2006-12-19 Thread Benjamin Tyner
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

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

2006-12-19 Thread Duncan Murdoch
On 12/19/2006 1:58 PM, Benjamin Tyner wrote: > I'm trying to figure out why the presence of a Fortran call affects the > result of a floating-point operation. I have C functions On Windows, it's fairly common for runtime libraries to switch the precision from 80 bit to 64 bit. R on Windows trie

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

2006-12-19 Thread Benjamin Tyner
I'm trying to figure out why the presence of a Fortran call affects the result of a floating-point operation. I have C functions void test1(int *n, double *f){ int outC; double c0; c0 = (double) *n * *f; outC = floor(c0); printf("when f computed by R, C says %d by itself\n",outC); }