There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
The OP didn't say sign function, he said sign of a number. Actually, he said sgn($x) three times. In real numbers, 0 is neither positive nor negative. The fiction of "negative zero" in some floating point implementations can be interesting but doesn't trump the existence of the Real number system. And that the OP wanted 0 returned for the "sign" of zero is quite clearly stated in multiple ways, despite your misinterpretting "sign of a number" to mean "sign of a floating point number (in an implementation that implements negative zero and 'treats negative zero consistently in arithmetic operations')". The ability to get -1 from "negative zero" on some systems is surely useful in some cases. But it is certainly not the only useful result. - tye In reply to Re^6: Spaceship Zero (real)
by tye
|
|