diff options
author | bde <bde@FreeBSD.org> | 2008-01-19 18:13:21 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2008-01-19 18:13:21 +0000 |
commit | 6d3cabaca67f9010aadf6be4c1e6fd9db54fbfa3 (patch) | |
tree | 65425aea94dc0a1ca7b1b5f88ea2ac05be347237 /lib/msun/src | |
parent | 2bedc0a58fffdfe3dac47475a565404e77b6ea2c (diff) | |
download | FreeBSD-src-6d3cabaca67f9010aadf6be4c1e6fd9db54fbfa3.zip FreeBSD-src-6d3cabaca67f9010aadf6be4c1e6fd9db54fbfa3.tar.gz |
Use STRICT_ASSIGN() for log1pf() and log1p() instead of a volatile cast
hack for log1pf() only. The cast hack broke with gcc-4, resulting in
~1 million errors of more than 1 ulp, with a maximum error of ~1.5 ulps.
Now the maximum error for log1pf() on i386 is 0.5034 ulps again (this
depends on extra precision), and log1p() has a chance of working with
extra precision.
See s_log1pf.c 1.8 for the original hack. (It claims only 62343 large
errors).
Convert to _FBSDID(). Another thing broken with gcc-4 is the static
const hack used for rcsids.
Diffstat (limited to 'lib/msun/src')
-rw-r--r-- | lib/msun/src/s_log1p.c | 9 | ||||
-rw-r--r-- | lib/msun/src/s_log1pf.c | 9 |
2 files changed, 10 insertions, 8 deletions
diff --git a/lib/msun/src/s_log1p.c b/lib/msun/src/s_log1p.c index 0ee69a6..1af5892 100644 --- a/lib/msun/src/s_log1p.c +++ b/lib/msun/src/s_log1p.c @@ -10,9 +10,8 @@ * ==================================================== */ -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); /* double log1p(double x) * @@ -79,6 +78,8 @@ static char rcsid[] = "$FreeBSD$"; * See HP-15C Advanced Functions Handbook, p.193. */ +#include <float.h> + #include "math.h" #include "math_private.h" @@ -124,7 +125,7 @@ log1p(double x) if (hx >= 0x7ff00000) return x+x; if(k!=0) { if(hx<0x43400000) { - u = 1.0+x; + STRICT_ASSIGN(double,u,1.0+x); GET_HIGH_WORD(hu,u); k = (hu>>20)-1023; c = (k>0)? 1.0-(u-x):x-(u-1.0);/* correction term */ diff --git a/lib/msun/src/s_log1pf.c b/lib/msun/src/s_log1pf.c index eb0f4af..6b2fbc7 100644 --- a/lib/msun/src/s_log1pf.c +++ b/lib/msun/src/s_log1pf.c @@ -13,9 +13,10 @@ * ==================================================== */ -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); + +#include <float.h> #include "math.h" #include "math_private.h" @@ -62,7 +63,7 @@ log1pf(float x) if (hx >= 0x7f800000) return x+x; if(k!=0) { if(hx<0x5a000000) { - *(volatile float *)&u = (float)1.0+x; + STRICT_ASSIGN(float,u,(float)1.0+x); GET_FLOAT_WORD(hu,u); k = (hu>>23)-127; /* correction term */ |