diff options
-rw-r--r-- | lib/msun/src/e_hypot.c | 8 | ||||
-rw-r--r-- | lib/msun/src/e_hypotf.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/msun/src/e_hypot.c b/lib/msun/src/e_hypot.c index e2f82ac..932b5db 100644 --- a/lib/msun/src/e_hypot.c +++ b/lib/msun/src/e_hypot.c @@ -11,9 +11,8 @@ * ==================================================== */ -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); /* __ieee754_hypot(x,y) * @@ -68,7 +67,8 @@ __ieee754_hypot(double x, double y) if(ha > 0x5f300000) { /* a>2**500 */ if(ha >= 0x7ff00000) { /* Inf or NaN */ u_int32_t low; - w = a+b; /* for sNaN */ + /* Use original arg order iff result is NaN; quieten sNaNs. */ + w = fabs(x+0.0)+fabs(y+0.0); GET_LOW_WORD(low,a); if(((ha&0xfffff)|low)==0) w = a; GET_LOW_WORD(low,b); diff --git a/lib/msun/src/e_hypotf.c b/lib/msun/src/e_hypotf.c index 0624a39..b100b75 100644 --- a/lib/msun/src/e_hypotf.c +++ b/lib/msun/src/e_hypotf.c @@ -13,9 +13,8 @@ * ==================================================== */ -#ifndef lint -static char rcsid[] = "$FreeBSD$"; -#endif +#include <sys/cdefs.h> +__FBSDID("$FreeBSD$"); #include "math.h" #include "math_private.h" @@ -37,7 +36,8 @@ __ieee754_hypotf(float x, float y) k=0; if(ha > 0x58800000) { /* a>2**50 */ if(ha >= 0x7f800000) { /* Inf or NaN */ - w = a+b; /* for sNaN */ + /* Use original arg order iff result is NaN; quieten sNaNs. */ + w = fabsf(x+0.0F)+fabsf(y+0.0F); if(ha == 0x7f800000) w = a; if(hb == 0x7f800000) w = b; return w; |