Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-22 Thread Miod Vallat
A fix has been committed, but there's still a problem on loongson with libm updated: [...] This is definitely a problem in gdtoa. The values are always computed the same, but do not get printed correctly, as shown by this modified test program. Both lines should print 0.606531 for the

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-13 Thread Miod Vallat
A fix has been committed, but there's still a problem on loongson with libm updated: $ ls -l /usr/lib/libm.so.* -r--r--r-- 1 root bin 926033 Feb 12 12:17 /usr/lib/libm.so.9.0 $ cc -o expl expl.c -O2 -pipe -lm $ for in in 1 2 3 4 5 6 ; do ./expl ; done theta == 1, pr == -9.15569e-2474,

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-12 Thread Donovan Watteau
On Thu, 6 Feb 2014, Donovan Watteau wrote: David Coppa wrote: Take the following reduced test-case, adapted from what R's code does: ---8--- #include stdio.h #include stdlib.h #include math.h int main(void) { double theta = 1; long double lambda, pr, pr2;

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-12 Thread Martynas Venckus
On 2/12/14, Donovan Watteau tso...@gmail.com wrote: On Thu, 6 Feb 2014, Donovan Watteau wrote: David Coppa wrote: Take the following reduced test-case, adapted from what R's code does: ---8--- #include stdio.h #include stdlib.h #include math.h int main(void) { double

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-11 Thread Mark Kettenis
Date: Mon, 10 Feb 2014 22:35:02 -0700 (MST) From: Martynas Venckus marty...@cvs.openbsd.org Here's a diff that sticks a bit closer to the original code. It's equivalent to your diff, and admittedly purely a matter of taste which version to prefer. I prefer my version better. It's

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-10 Thread David Coppa
On Fri, Feb 7, 2014 at 4:03 PM, David Coppa dco...@gmail.com wrote: On Fri, Feb 7, 2014 at 3:49 PM, Mark Kettenis mark.kette...@xs4all.nl wrote: Date: Thu, 6 Feb 2014 23:07:58 -0800 From: Martynas Venckus marty...@venck.us Yup.Does this diff fix it for you? Here's a diff that sticks a

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-10 Thread Martynas Venckus
Here's a diff that sticks a bit closer to the original code. It's equivalent to your diff, and admittedly purely a matter of taste which version to prefer. I prefer my version better. It's not '93 anymore and compilers are able to convert 0.0L and -1.0L precisely, otherwise we have a huge

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-10 Thread David Coppa
On Tue, Feb 11, 2014 at 6:35 AM, Martynas Venckus marty...@cvs.openbsd.org wrote: Here's a diff that sticks a bit closer to the original code. It's equivalent to your diff, and admittedly purely a matter of taste which version to prefer. I prefer my version better. It's not '93 anymore and

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-07 Thread David Coppa
On Fri, Feb 7, 2014 at 8:07 AM, Martynas Venckus marty...@venck.us wrote: Yup.Does this diff fix it for you? Yeah! It works. And R-3's testsuite is also happy now. Thanks a lot! And thanks to Daniel too... ok dcoppa@ to commit it, obviously Ciao, David On 2/6/14, Daniel Dickman

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-07 Thread Mark Kettenis
Date: Thu, 6 Feb 2014 23:07:58 -0800 From: Martynas Venckus marty...@venck.us Yup.Does this diff fix it for you? Here's a diff that sticks a bit closer to the original code. It's equivalent to your diff, and admittedly purely a matter of taste which version to prefer. Index: s_floorl.c

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-07 Thread David Coppa
On Fri, Feb 7, 2014 at 3:49 PM, Mark Kettenis mark.kette...@xs4all.nl wrote: Date: Thu, 6 Feb 2014 23:07:58 -0800 From: Martynas Venckus marty...@venck.us Yup.Does this diff fix it for you? Here's a diff that sticks a bit closer to the original code. It's equivalent to your diff, and

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-06 Thread Donovan Watteau
David Coppa wrote: Take the following reduced test-case, adapted from what R's code does: ---8--- #include stdio.h #include stdlib.h #include math.h int main(void) { double theta = 1; long double lambda, pr, pr2; lambda = (0.5*theta); pr = exp(-lambda);

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-06 Thread Daniel Dickman
I think I recently ran into a similar issue but I suspect the root cause might be the same. I think the floorl function is wrong for numbers slightly larger than -1 to numbers slightly below 0. In this range floorl returns -0 instead of -1. On Feb 5, 2014, at 3:57 AM, David Coppa

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-06 Thread Martynas Venckus
Yup.Does this diff fix it for you? On 2/6/14, Daniel Dickman didick...@gmail.com wrote: I think I recently ran into a similar issue but I suspect the root cause might be the same. I think the floorl function is wrong for numbers slightly larger than -1 to numbers slightly below 0. In this

exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-05 Thread David Coppa
Hi! I hit this problem while working on updating math/R from version 2.15.3 to the latest version (3.0.2). It started happening since upstream switched from double functions to C99 long double functions (expl, fabsl, ...), during the R-3 development cycle. Take the following reduced test-case,

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-05 Thread Mark Kettenis
Date: Wed, 5 Feb 2014 01:57:33 -0700 From: David Coppa dco...@openbsd.org Hi! I hit this problem while working on updating math/R from version 2.15.3 to the latest version (3.0.2). It started happening since upstream switched from double functions to C99 long double functions (expl,

Re: exp() / expl() on Linux and OpenBSD (expl() bug?)

2014-02-05 Thread Mark Kettenis
Date: Wed, 5 Feb 2014 01:57:33 -0700 From: David Coppa dco...@openbsd.org Hi! I hit this problem while working on updating math/R from version 2.15.3 to the latest version (3.0.2). It started happening since upstream switched from double functions to C99 long double functions (expl,