Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/arch Don't ever return -0.0.



details:   https://anonhg.NetBSD.org/src/rev/7efc379f216f
branches:  trunk
changeset: 475913:7efc379f216f
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Sun Aug 29 19:04:02 1999 +0000

description:
Don't ever return -0.0.

diffstat:

 lib/libc/arch/alpha/gen/ldexp.c   |  13 +++++--------
 lib/libc/arch/arm32/gen/ldexp.c   |  13 +++++--------
 lib/libc/arch/m68k/gen/ldexp.c    |  13 +++++--------
 lib/libc/arch/powerpc/gen/ldexp.c |  13 +++++--------
 lib/libc/arch/sparc/gen/ldexp.c   |  13 +++++--------
 lib/libc/arch/sparc64/gen/ldexp.c |  13 +++++--------
 6 files changed, 30 insertions(+), 48 deletions(-)

diffs (294 lines):

diff -r 5e283395d05c -r 7efc379f216f lib/libc/arch/alpha/gen/ldexp.c
--- a/lib/libc/arch/alpha/gen/ldexp.c   Sun Aug 29 18:58:03 1999 +0000
+++ b/lib/libc/arch/alpha/gen/ldexp.c   Sun Aug 29 19:04:02 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ldexp.c,v 1.4 1999/08/29 18:40:50 mycroft Exp $        */
+/*     $NetBSD: ldexp.c,v 1.5 1999/08/29 19:04:02 mycroft Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,7 +44,7 @@
 #if 0
 static const char sccsid[] = "@(#)ldexp.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: ldexp.c,v 1.4 1999/08/29 18:40:50 mycroft Exp $");
+__RCSID("$NetBSD: ldexp.c,v 1.5 1999/08/29 19:04:02 mycroft Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -97,11 +97,8 @@
                 * (see comments in machine/ieee.h).
                 */
                if (newexp <= -DBL_FRACBITS) {
-                       /* u.s.dbl_sign = val < 0.0; -- already set */
-                       u.s.dbl_exp = 0;
-                       u.s.dbl_frach = u.s.dbl_fracl = 0;
                        errno = ERANGE;
-                       return (u.v);           /* zero */
+                       return (0.0);
                }
                /*
                 * We are going to produce a denorm.  Our `exp' argument
@@ -109,7 +106,7 @@
                 * 2^-2097, so we may have to do this as many as three
                 * steps (not just two, as for positive `exp's below).
                 */
-               mul.v = 0.0;
+               mul.v = 1.0;
                while (exp <= -DBL_EXP_BIAS) {
                        mul.s.dbl_exp = 1;
                        val *= mul.v;
@@ -137,7 +134,7 @@
                 * arithmetic just as for normal `double's.
                 */
                mulexp = exp <= DBL_EXP_BIAS ? exp : DBL_EXP_BIAS;
-               mul.v = 0.0;
+               mul.v = 1.0;
                mul.s.dbl_exp = mulexp + DBL_EXP_BIAS;
                val *= mul.v;
                if (mulexp == exp)
diff -r 5e283395d05c -r 7efc379f216f lib/libc/arch/arm32/gen/ldexp.c
--- a/lib/libc/arch/arm32/gen/ldexp.c   Sun Aug 29 18:58:03 1999 +0000
+++ b/lib/libc/arch/arm32/gen/ldexp.c   Sun Aug 29 19:04:02 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ldexp.c,v 1.7 1999/08/29 18:40:50 mycroft Exp $        */
+/*     $NetBSD: ldexp.c,v 1.8 1999/08/29 19:04:03 mycroft Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,7 +44,7 @@
 #if 0
 static const char sccsid[] = "@(#)ldexp.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: ldexp.c,v 1.7 1999/08/29 18:40:50 mycroft Exp $");
+__RCSID("$NetBSD: ldexp.c,v 1.8 1999/08/29 19:04:03 mycroft Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -97,11 +97,8 @@
                 * (see comments in machine/ieee.h).
                 */
                if (newexp <= -DBL_FRACBITS) {
-                       /* u.s.dbl_sign = val < 0.0; -- already set */
-                       u.s.dbl_exp = 0;
-                       u.s.dbl_frach = u.s.dbl_fracl = 0;
                        errno = ERANGE;
-                       return (u.v);           /* zero */
+                       return (0.0);
                }
                /*
                 * We are going to produce a denorm.  Our `exp' argument
@@ -109,7 +106,7 @@
                 * 2^-2097, so we may have to do this as many as three
                 * steps (not just two, as for positive `exp's below).
                 */
-               mul.v = 0.0;
+               mul.v = 1.0;
                while (exp <= -DBL_EXP_BIAS) {
                        mul.s.dbl_exp = 1;
                        val *= mul.v;
@@ -137,7 +134,7 @@
                 * arithmetic just as for normal `double's.
                 */
                mulexp = exp <= DBL_EXP_BIAS ? exp : DBL_EXP_BIAS;
-               mul.v = 0.0;
+               mul.v = 1.0;
                mul.s.dbl_exp = mulexp + DBL_EXP_BIAS;
                val *= mul.v;
                if (mulexp == exp)
diff -r 5e283395d05c -r 7efc379f216f lib/libc/arch/m68k/gen/ldexp.c
--- a/lib/libc/arch/m68k/gen/ldexp.c    Sun Aug 29 18:58:03 1999 +0000
+++ b/lib/libc/arch/m68k/gen/ldexp.c    Sun Aug 29 19:04:02 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ldexp.c,v 1.5 1999/08/29 18:40:50 mycroft Exp $        */
+/*     $NetBSD: ldexp.c,v 1.6 1999/08/29 19:04:03 mycroft Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,7 +44,7 @@
 #if 0
 static const char sccsid[] = "@(#)ldexp.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: ldexp.c,v 1.5 1999/08/29 18:40:50 mycroft Exp $");
+__RCSID("$NetBSD: ldexp.c,v 1.6 1999/08/29 19:04:03 mycroft Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -97,11 +97,8 @@
                 * (see comments in machine/ieee.h).
                 */
                if (newexp <= -DBL_FRACBITS) {
-                       /* u.s.dbl_sign = val < 0.0; -- already set */
-                       u.s.dbl_exp = 0;
-                       u.s.dbl_frach = u.s.dbl_fracl = 0;
                        errno = ERANGE;
-                       return (u.v);           /* zero */
+                       return (0.0);
                }
                /*
                 * We are going to produce a denorm.  Our `exp' argument
@@ -109,7 +106,7 @@
                 * 2^-2097, so we may have to do this as many as three
                 * steps (not just two, as for positive `exp's below).
                 */
-               mul.v = 0.0;
+               mul.v = 1.0;
                while (exp <= -DBL_EXP_BIAS) {
                        mul.s.dbl_exp = 1;
                        val *= mul.v;
@@ -137,7 +134,7 @@
                 * arithmetic just as for normal `double's.
                 */
                mulexp = exp <= DBL_EXP_BIAS ? exp : DBL_EXP_BIAS;
-               mul.v = 0.0;
+               mul.v = 1.0;
                mul.s.dbl_exp = mulexp + DBL_EXP_BIAS;
                val *= mul.v;
                if (mulexp == exp)
diff -r 5e283395d05c -r 7efc379f216f lib/libc/arch/powerpc/gen/ldexp.c
--- a/lib/libc/arch/powerpc/gen/ldexp.c Sun Aug 29 18:58:03 1999 +0000
+++ b/lib/libc/arch/powerpc/gen/ldexp.c Sun Aug 29 19:04:02 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ldexp.c,v 1.4 1999/08/29 18:40:51 mycroft Exp $        */
+/*     $NetBSD: ldexp.c,v 1.5 1999/08/29 19:04:03 mycroft Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,7 +44,7 @@
 #if 0
 static const char sccsid[] = "@(#)ldexp.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: ldexp.c,v 1.4 1999/08/29 18:40:51 mycroft Exp $");
+__RCSID("$NetBSD: ldexp.c,v 1.5 1999/08/29 19:04:03 mycroft Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -97,11 +97,8 @@
                 * (see comments in machine/ieee.h).
                 */
                if (newexp <= -DBL_FRACBITS) {
-                       /* u.s.dbl_sign = val < 0.0; -- already set */
-                       u.s.dbl_exp = 0;
-                       u.s.dbl_frach = u.s.dbl_fracl = 0;
                        errno = ERANGE;
-                       return (u.v);           /* zero */
+                       return (0.0);
                }
                /*
                 * We are going to produce a denorm.  Our `exp' argument
@@ -109,7 +106,7 @@
                 * 2^-2097, so we may have to do this as many as three
                 * steps (not just two, as for positive `exp's below).
                 */
-               mul.v = 0.0;
+               mul.v = 1.0;
                while (exp <= -DBL_EXP_BIAS) {
                        mul.s.dbl_exp = 1;
                        val *= mul.v;
@@ -137,7 +134,7 @@
                 * arithmetic just as for normal `double's.
                 */
                mulexp = exp <= DBL_EXP_BIAS ? exp : DBL_EXP_BIAS;
-               mul.v = 0.0;
+               mul.v = 1.0;
                mul.s.dbl_exp = mulexp + DBL_EXP_BIAS;
                val *= mul.v;
                if (mulexp == exp)
diff -r 5e283395d05c -r 7efc379f216f lib/libc/arch/sparc/gen/ldexp.c
--- a/lib/libc/arch/sparc/gen/ldexp.c   Sun Aug 29 18:58:03 1999 +0000
+++ b/lib/libc/arch/sparc/gen/ldexp.c   Sun Aug 29 19:04:02 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ldexp.c,v 1.4 1999/08/29 18:40:51 mycroft Exp $        */
+/*     $NetBSD: ldexp.c,v 1.5 1999/08/29 19:04:03 mycroft Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,7 +44,7 @@
 #if 0
 static const char sccsid[] = "@(#)ldexp.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: ldexp.c,v 1.4 1999/08/29 18:40:51 mycroft Exp $");
+__RCSID("$NetBSD: ldexp.c,v 1.5 1999/08/29 19:04:03 mycroft Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -97,11 +97,8 @@
                 * (see comments in machine/ieee.h).
                 */
                if (newexp <= -DBL_FRACBITS) {
-                       /* u.s.dbl_sign = val < 0.0; -- already set */
-                       u.s.dbl_exp = 0;
-                       u.s.dbl_frach = u.s.dbl_fracl = 0;
                        errno = ERANGE;
-                       return (u.v);           /* zero */
+                       return (0.0);
                }
                /*
                 * We are going to produce a denorm.  Our `exp' argument
@@ -109,7 +106,7 @@
                 * 2^-2097, so we may have to do this as many as three
                 * steps (not just two, as for positive `exp's below).
                 */
-               mul.v = 0.0;
+               mul.v = 1.0;
                while (exp <= -DBL_EXP_BIAS) {
                        mul.s.dbl_exp = 1;
                        val *= mul.v;
@@ -137,7 +134,7 @@
                 * arithmetic just as for normal `double's.
                 */
                mulexp = exp <= DBL_EXP_BIAS ? exp : DBL_EXP_BIAS;
-               mul.v = 0.0;
+               mul.v = 1.0;
                mul.s.dbl_exp = mulexp + DBL_EXP_BIAS;
                val *= mul.v;
                if (mulexp == exp)
diff -r 5e283395d05c -r 7efc379f216f lib/libc/arch/sparc64/gen/ldexp.c
--- a/lib/libc/arch/sparc64/gen/ldexp.c Sun Aug 29 18:58:03 1999 +0000
+++ b/lib/libc/arch/sparc64/gen/ldexp.c Sun Aug 29 19:04:02 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ldexp.c,v 1.3 1999/08/29 18:40:51 mycroft Exp $        */
+/*     $NetBSD: ldexp.c,v 1.4 1999/08/29 19:04:03 mycroft Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -44,7 +44,7 @@
 #if 0
 static const char sccsid[] = "@(#)ldexp.c      8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: ldexp.c,v 1.3 1999/08/29 18:40:51 mycroft Exp $");
+__RCSID("$NetBSD: ldexp.c,v 1.4 1999/08/29 19:04:03 mycroft Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -97,11 +97,8 @@
                 * (see comments in machine/ieee.h).
                 */
                if (newexp <= -DBL_FRACBITS) {
-                       /* u.s.dbl_sign = val < 0.0; -- already set */
-                       u.s.dbl_exp = 0;
-                       u.s.dbl_frach = u.s.dbl_fracl = 0;
                        errno = ERANGE;
-                       return (u.v);           /* zero */
+                       return (0.0);
                }
                /*
                 * We are going to produce a denorm.  Our `exp' argument
@@ -109,7 +106,7 @@
                 * 2^-2097, so we may have to do this as many as three
                 * steps (not just two, as for positive `exp's below).
                 */
-               mul.v = 0.0;
+               mul.v = 1.0;
                while (exp <= -DBL_EXP_BIAS) {
                        mul.s.dbl_exp = 1;
                        val *= mul.v;
@@ -137,7 +134,7 @@
                 * arithmetic just as for normal `double's.
                 */
                mulexp = exp <= DBL_EXP_BIAS ? exp : DBL_EXP_BIAS;
-               mul.v = 0.0;
+               mul.v = 1.0;
                mul.s.dbl_exp = mulexp + DBL_EXP_BIAS;
                val *= mul.v;
                if (mulexp == exp)



Home | Main Index | Thread Index | Old Index