|
|
| Come for the quick hacks, stay for the epiphanies. | |
| PerlMonks |
Re^2: Seeing if two numbers have the same signby hipowls (Curate) |
| on Jan 10, 2008 at 21:22 UTC ( [id://661736]=note: print w/replies, xml ) | Need Help?? |
|
Neat (wish I'd thought of it) but it implicitly assumes that zero is a positive number, given 0 and -1 the test returns 0, given 0 and +1 it returns 1. If the test was ( $x<=0 == $y<=0 ) then zero is treated as both positive and negative and the two previous examples return 1. Which is consistent but might not be what you want.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||