Subject: printf question
To: None <tech-userlevel@netbsd.org>
From: Lennart Augustsson <lennart@mail.augustsson.net>
List: tech-userlevel
Date: 01/23/2001 21:38:45
OK, you standards gurus, here's a question?
Should printf print the sign of -0.0?
Since IEEE has negative 0 I think it should, but what does the standards say.
Here's a program that illustrates the question:
#include <math.h>
main()
{
double x = -1, y = 0;
printf("%g %g\n", x, y);
printf("%llx %llx\n", x, y);
y = copysign(y, x);
printf("%g %g\n", x, y);
printf("%llx %llx\n", x, y);
}
-- Lennart