[comp.lang.perl] Negative 0

worley@compass.com (Dale Worley) (02/23/91)

The following program

	print int(-0.5);

prints

	-0

on a Sun3.  This is because Sun's printf will return "-0" for the
floating point value is being produced by int.  According to Harbison
and Steele, printf should never put a minus sign on a zero value.
Thus, somebody's screwing up.  The question is, is it (1) Perl's int
is producing an invalid floating point number (a zero with the minus
bit set), or is it (2) Sun's printf doesn't print negative zero
floating point numbers correctly?  I suspect this has discovered
previously because the floating point hardware never produces negative
zero values.

Dale

Dale Worley		Compass, Inc.			worley@compass.com
--
The world ends tomorrow -- be sure to back up your files!