Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libm/src Fix incorrect magic numbers in scaling. From F...



details:   https://anonhg.NetBSD.org/src/rev/9b0d65f30233
branches:  trunk
changeset: 343204:9b0d65f30233
user:      gson <gson%NetBSD.org@localhost>
date:      Sun Jan 24 20:34:30 2016 +0000

description:
Fix incorrect magic numbers in scaling.  From FreeBSD commit 23397, by
way of Rin Okuyama.  Fixes PR lib/50698.

diffstat:

 lib/libm/src/e_hypotf.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (42 lines):

diff -r f10e323b402c -r 9b0d65f30233 lib/libm/src/e_hypotf.c
--- a/lib/libm/src/e_hypotf.c   Sun Jan 24 20:26:47 2016 +0000
+++ b/lib/libm/src/e_hypotf.c   Sun Jan 24 20:34:30 2016 +0000
@@ -15,7 +15,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: e_hypotf.c,v 1.9 2008/04/25 22:21:53 christos Exp $");
+__RCSID("$NetBSD: e_hypotf.c,v 1.10 2016/01/24 20:34:30 gson Exp $");
 #endif
 
 #include "math.h"
@@ -43,22 +43,22 @@
               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);
            }



Home | Main Index | Thread Index | Old Index