The following macro is to determine if two numbers have the same sign, is for 2's complement number representation.
#define SAME_SIGNS( a, b ) (((long) ((unsigned long) a ^ (unsigned long) b)) >= 0 )
Can anyone suggest a javascript equivalent function?
function sameSigns(a, b) { return (((a >>> 0) ^ (b >>> 0)) | 0) >= 0; }// But notice that a, b are FLOAT in NOT INTEGER, so the implementation is wrong somehow.