Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/gen In case of underflow, return -0.0 or +0.0, depe...



details:   https://anonhg.NetBSD.org/src/rev/4e4483de04c2
branches:  trunk
changeset: 556942:4e4483de04c2
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Dec 30 23:19:07 2003 +0000

description:
In case of underflow, return -0.0 or +0.0, depending on the sign of
the argument.
This makes sparc64 pass regress/lib/libc/ldexp.

diffstat:

 lib/libc/gen/ldexp_ieee754.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (44 lines):

diff -r 4659b7b9a7b7 -r 4e4483de04c2 lib/libc/gen/ldexp_ieee754.c
--- a/lib/libc/gen/ldexp_ieee754.c      Tue Dec 30 22:56:40 2003 +0000
+++ b/lib/libc/gen/ldexp_ieee754.c      Tue Dec 30 23:19:07 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ldexp_ieee754.c,v 1.3 2003/10/27 03:09:43 mrg Exp $    */
+/*     $NetBSD: ldexp_ieee754.c,v 1.4 2003/12/30 23:19:07 martin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: ldexp_ieee754.c,v 1.3 2003/10/27 03:09:43 mrg Exp $");
+__RCSID("$NetBSD: ldexp_ieee754.c,v 1.4 2003/12/30 23:19:07 martin Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include <sys/types.h>
@@ -76,14 +76,14 @@
                         */
                        if (expon <= -DBL_FRACBITS) {
                                errno = ERANGE;
-                               return (0.0);
+                               return (val < 0.0 ? -0.0 : 0.0);
                        }
                        mul.dblu_d = 0.0;
                        mul.dblu_dbl.dbl_exp = expon + DBL_EXP_BIAS;
                        u.dblu_d *= mul.dblu_d;
                        if (u.dblu_d == 0.0) {
                                errno = ERANGE;
-                               return (0.0);
+                               return (val < 0.0 ? -0.0 : 0.0);
                        }
                        return (u.dblu_d);
                } else {
@@ -113,7 +113,7 @@
                 */
                if (newexp <= -DBL_FRACBITS) {
                        errno = ERANGE;
-                       return (0.0);
+                       return (val < 0.0 ? -0.0 : 0.0);
                }
                /*
                 * Denormalize the result.  We do this with a multiply.  If



Home | Main Index | Thread Index | Old Index