NetBSD Problem Report #3137
Received: (qmail-queue invoked from smtpd); 25 Jan 1997 00:53:20 -0000
Message-Id: <199701250049.BAA17333@animal.cs.chalmers.se>
Date: Sat, 25 Jan 1997 01:49:40 +0100 (MET)
From: Lennart Augustsson <augustss@cs.chalmers.se>
Reply-To: augustss@netbsd.org
To: gnats-bugs@gnats.netbsd.org
Subject: printf doesn't print sign of -0.0
X-Send-Pr-Version: 3.95
>Number: 3137
>Category: lib
>Synopsis: printf doesn't print sign of -0.0
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: standards-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 24 17:05:01 +0000 1997
>Closed-Date: Tue Nov 27 18:01:35 +0000 2001
>Last-Modified: Tue Nov 27 18:01:35 +0000 2001
>Originator: Lennart Augustsson
>Release: 19970121
>Organization:
Department of Computing Science, Chalmers University
>Environment:
System: NetBSD calvin.cs.chalmers.se 1.2B NetBSD 1.2B (CALVIN) #70: Tue Jan 21 18:52:37 MET 1997 augustss@calvin.cs.chalmers.se:/usr/src/sys/arch/i386/compile/CALVIN i386
>Description:
printf(3) does not print negative 0 with a minus sign.
I don't know what POSIX has to say on this (if anything),
but several other platforms do print it with a - sign.
>How-To-Repeat:
Run this program. As you can see x indeed has negative
sign, but it is printed as a non-negative number.
#include <math.h>
main()
{
double x = 0;
x = -x;
printf("%e %e\n", x, copysign(1.0, x));
}
>Fix:
If we indeed want to print negative 0 with a sign I can make a fix.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: lib-bug-people->standards-manager
Responsible-Changed-By: fair
Responsible-Changed-When: Thu Mar 22 12:38:54 PST 2001
Responsible-Changed-Why:
Really a standards compliance matter...
State-Changed-From-To: open->analyzed
State-Changed-By: kleink
State-Changed-When: Thu Mar 22 15:05:53 PST 2001
State-Changed-Why:
According to C99 7.19.6.1#6, "The results of all floating conversions of a
negative zero, and of negative values that round to zero, include a minus
sign."
State-Changed-From-To: analyzed->closed
State-Changed-By: augustss
State-Changed-When: Tue Nov 27 10:01:09 PST 2001
State-Changed-Why:
Fixed.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.