Source-Changes-HG archive

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

[src/netbsd-3]: src/lib/libc/gen Pull up following revision(s) (requested by ...



details:   https://anonhg.NetBSD.org/src/rev/22b87be9108a
branches:  netbsd-3
changeset: 577898:22b87be9108a
user:      riz <riz%NetBSD.org@localhost>
date:      Fri Mar 24 22:41:07 2006 +0000

description:
Pull up following revision(s) (requested by drochner in ticket #1216):
        lib/libc/gen/frexp_ieee754.c: revision 1.5
scale denormal numbers, to get a meaningful exponent (and a mantissa
which just consists of the implicit bit),
fixes PR lib/32861 by FX Coudert
(the bug was seen in gfortran stress tests)
(we should use the code in fdlibm as we do for frexpf())

diffstat:

 lib/libc/gen/frexp_ieee754.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 30b3d3cd8c8c -r 22b87be9108a lib/libc/gen/frexp_ieee754.c
--- a/lib/libc/gen/frexp_ieee754.c      Fri Mar 24 22:35:33 2006 +0000
+++ b/lib/libc/gen/frexp_ieee754.c      Fri Mar 24 22:41:07 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: frexp_ieee754.c,v 1.4 2003/10/27 00:05:46 kleink Exp $ */
+/*     $NetBSD: frexp_ieee754.c,v 1.4.6.1 2006/03/24 22:41:07 riz Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)frexp.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: frexp_ieee754.c,v 1.4 2003/10/27 00:05:46 kleink Exp $");
+__RCSID("$NetBSD: frexp_ieee754.c,v 1.4.6.1 2006/03/24 22:41:07 riz Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -66,7 +66,13 @@
                 */
                u.dblu_d = value;
                if (u.dblu_dbl.dbl_exp != DBL_EXP_INFNAN) {
-                       *eptr = u.dblu_dbl.dbl_exp - (DBL_EXP_BIAS - 1);
+                       *eptr = 0;
+                       if (u.dblu_dbl.dbl_exp == 0) {
+                               /* denormal, scale out of mantissa */
+                               *eptr = -DBL_FRACBITS;
+                               u.dblu_d *= 4.50359962737049600000e+15;
+                       }
+                       *eptr += u.dblu_dbl.dbl_exp - (DBL_EXP_BIAS - 1);
                        u.dblu_dbl.dbl_exp = DBL_EXP_BIAS - 1;
                }
                return (u.dblu_d);



Home | Main Index | Thread Index | Old Index