Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/stdio Print sign of -0.0 correctly. Fixes PR 3137 ...



details:   https://anonhg.NetBSD.org/src/rev/9d9bfb56faab
branches:  trunk
changeset: 518288:9d9bfb56faab
user:      augustss <augustss%NetBSD.org@localhost>
date:      Tue Nov 27 18:00:55 2001 +0000

description:
Print sign of -0.0 correctly.  Fixes PR 3137 (mine).

diffstat:

 lib/libc/stdio/vfprintf.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 47411389757f -r 9d9bfb56faab lib/libc/stdio/vfprintf.c
--- a/lib/libc/stdio/vfprintf.c Tue Nov 27 17:59:49 2001 +0000
+++ b/lib/libc/stdio/vfprintf.c Tue Nov 27 18:00:55 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfprintf.c,v 1.37 2001/11/04 13:57:30 lukem Exp $      */
+/*     $NetBSD: vfprintf.c,v 1.38 2001/11/27 18:00:55 augustss Exp $   */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -41,7 +41,7 @@
 #if 0
 static char *sccsid = "@(#)vfprintf.c  5.50 (Berkeley) 12/16/92";
 #else
-__RCSID("$NetBSD: vfprintf.c,v 1.37 2001/11/04 13:57:30 lukem Exp $");
+__RCSID("$NetBSD: vfprintf.c,v 1.38 2001/11/27 18:00:55 augustss Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -812,7 +812,7 @@
                mode = 2;               /* ndigits significant digits */
        }
 
-       if (value < 0) {
+       if (copysign(1.0, value) < 0) { /* Use copysign to handle -0.0 */
                value = -value;
                *sign = '-';
        } else



Home | Main Index | Thread Index | Old Index