It seems to me that these functions that can only handle 32-bit numbers should only ACCEPT 32-bit numbers. Any input that is outside the numeric range accepted by $and/$or/etc should be considered invalid input. If you input a number greater than 0b11111111111111111111111111111111 you should get a standard mIRC error message or a $null/0 return from the function. In my opinion, these examples should give the same result.
$and(bonnie,clyde) = $null
$and(9999999999,9999999999) = $null
The functions currently return 0 for invalid input (non-numbers), but since 0 can be a valid result ($and(1,0) = 0), I think that they should be changed to return $null instead. This would cause the functions to always give a known result (valid result or $null).
A simple pseudocode:
function and {
if either input is not a number return NULL
elseif either input is too big or too small return NULL
else return inputA (BINARY_AND) inputB
}
-genius_at_work