Subject: lib/3137: printf doesn't print sign of -0.0
To: None <>
From: Lennart Augustsson <>
List: netbsd-bugs
Date: 01/25/1997 01:49:40
>Number:         3137
>Category:       lib
>Synopsis:       printf doesn't print sign of -0.0
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>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 1.2B NetBSD 1.2B (CALVIN) #70: Tue Jan 21 18:52:37 MET 1997 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.

#include <math.h>

    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.