Hi, Dan's solution is probably the clearest.
Just out of curiousity:. How would you in your program's context like 0 to be treated. should it be treated as a positive number or should it be treated as a case part. my suggestion a*b > 0 for example wouldn't work if you want 0 to be treated as positive number or if you compare 0 with 0 and want 'same sign' as answer bye N johnewing wrote:
I am trying to figure out how to test if two numbers are of the same sign (both positive or both negative). I have tried abs(x) / x == abs(y) / y but that fails when one of the numbers is 0. I'm sure that there is an easy way to do this. Any suggestions? Thanks
-- http://mail.python.org/mailman/listinfo/python-list