Re: [Rd] long double, C, fortran

2010-10-07 Thread Matt Shotwell
In working with small numbers, I usually look for a solution involving a log transformation. For instance, when a or b are very small, we can compute the ratio a / ( a + b ) more safely by 1 / ( 1 + exp( log(b) - log(a) ) ) Alternative data types are sure to cause issues with portability. It's

Re: [Rd] long double, C, fortran

2010-10-07 Thread Simon Urbanek
On Oct 7, 2010, at 2:28 PM, Richard D. Morey wrote: > I'm using .Call() to call C code from R under Windows (on an Intel Core 2 > duo). The C code involves some very small numbers, and I think I'm losing > precision using doubles. The magnitude of numbers has really nothing to do with precisio

[Rd] long double, C, fortran

2010-10-07 Thread Richard D. Morey
I'm using .Call() to call C code from R under Windows (on an Intel Core 2 duo). The C code involves some very small numbers, and I think I'm losing precision using doubles. I thought I might use long doubles to see if I can get that precision back. I have a few questions: 1. Does this affect