in reply to Re: Seeing if two numbers have the same sign
in thread Seeing if two numbers have the same sign
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Seeing if two numbers have the same sign
by graff (Chancellor) on Jan 12, 2008 at 17:48 UTC |