summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorbde <bde@FreeBSD.org>1997-03-05 11:54:00 +0000
committerbde <bde@FreeBSD.org>1997-03-05 11:54:00 +0000
commit8f4ea9b77677e120f9483560c4ca8faadad8357f (patch)
tree09c203a2eaeecfa5dbe286b8b563e04f2803684b /lib
parent6ba0dbd35ac15d0a0c9237de79d172cf19f7c01f (diff)
downloadFreeBSD-src-8f4ea9b77677e120f9483560c4ca8faadad8357f.zip
FreeBSD-src-8f4ea9b77677e120f9483560c4ca8faadad8357f.tar.gz
Fixed wrong magic numbers in scaling. hypotf() was very broken for large
and small values: hypotf(2.3819765e+38, 2.0416943e+38) was NaN instead of 3.1372484e+38 hypotf(-3.4028235e+38, 3.3886450e+38) was NaN instead of Inf hypotf(-2.8025969e-45, -2.8025969e-45) was 0 instead of 4.2038954e-45 Found by: ucbtest
Diffstat (limited to 'lib')
-rw-r--r--lib/msun/src/e_hypotf.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/msun/src/e_hypotf.c b/lib/msun/src/e_hypotf.c
index 747f8f6..e921585 100644
--- a/lib/msun/src/e_hypotf.c
+++ b/lib/msun/src/e_hypotf.c
@@ -14,7 +14,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id$";
+static char rcsid[] = "$Id: e_hypotf.c,v 1.4 1997/02/22 15:10:13 peter Exp $";
#endif
#include "math.h"
@@ -46,22 +46,22 @@ static char rcsid[] = "$Id$";
if(hb == 0x7f800000) w = b;
return w;
}
- /* scale a and b by 2**-60 */
- ha -= 0x5d800000; hb -= 0x5d800000; k += 60;
+ /* scale a and b by 2**-68 */
+ ha -= 0x22000000; hb -= 0x22000000; k += 68;
SET_FLOAT_WORD(a,ha);
SET_FLOAT_WORD(b,hb);
}
if(hb < 0x26800000) { /* b < 2**-50 */
if(hb <= 0x007fffff) { /* subnormal b or 0 */
if(hb==0) return a;
- SET_FLOAT_WORD(t1,0x3f000000); /* t1=2^126 */
+ SET_FLOAT_WORD(t1,0x7e800000); /* t1=2^126 */
b *= t1;
a *= t1;
k -= 126;
- } else { /* scale a and b by 2^60 */
- ha += 0x5d800000; /* a *= 2^60 */
- hb += 0x5d800000; /* b *= 2^60 */
- k -= 60;
+ } else { /* scale a and b by 2^68 */
+ ha += 0x22000000; /* a *= 2^68 */
+ hb += 0x22000000; /* b *= 2^68 */
+ k -= 68;
SET_FLOAT_WORD(a,ha);
SET_FLOAT_WORD(b,hb);
}
OpenPOWER on IntegriCloud