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.
This commit is contained in:
parent
6e8f9331d7
commit
0814af48f7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=175494
@ -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 */
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user