Subject: lib/3137: printf doesn't print sign of -0.0
To: None <firstname.lastname@example.org>
From: Lennart Augustsson <email@example.com>
Date: 01/25/1997 01:49:40
>Synopsis: printf doesn't print sign of -0.0
>Responsible: lib-bug-people (Library Bug People)
>Arrival-Date: Fri Jan 24 17:05:01 1997
>Originator: Lennart Augustsson
Department of Computing Science, Chalmers University
>Release: NetBSD-current 97-01-21
System: NetBSD calvin.cs.chalmers.se 1.2B NetBSD 1.2B (CALVIN) #70: Tue Jan 21 18:52:37 MET 1997 firstname.lastname@example.org:/usr/src/sys/arch/i386/compile/CALVIN i386
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.
Run this program. As you can see x indeed has negative
sign, but it is printed as a non-negative number.
double x = 0;
x = -x;
printf("%e %e\n", x, copysign(1.0, x));
If we indeed want to print negative 0 with a sign I can make a fix.