> From: dunb...@aol.com
> 
> Just ask yourself this"
> 
> answer testNumber mod 2
> 
> If you get a "1", testnumber is odd, if a "0", even.

Careful, x mod 2 will be -1 for a negative odd number. Better to test for
zero (even) or nonzero (odd).

By the way bitwise AND normally works for negative or positive numbers on a
two's complement machine (which is probably every machine that LiveCode ever
has or ever will run on. In C, one can test for an odd integer with x & 1.
Yet bitAnd doesn't work on negative numbers. It is documented that way, but
I think this is an unnecessary and unexpected limitation.

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:pdero...@ix.netcom.com 


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to