set the itemdelimiter to "." put (the number of items in (x/2) is 2) into isOdd
On Mon, Aug 5, 2013 at 3:37 PM, kee nethery <[email protected]> wrote: > OK I'll toss in a combo. > > put ((last char of trunc(x)) mod 2) = 0 into isOdd > > allows for a floating value of "x" which it should never be given but > would be nice if it could handle > allows for a quick mod calculation of a single digit rather than whatever > the entire value of "x" is (perhaps speeds up execution?) > > Kee Nethery > > > On Aug 5, 2013, at 1:30 PM, Paul D. DeRocco <[email protected]> > wrote: > > >> From: [email protected] > >> > >> 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:[email protected] > > > > > > _______________________________________________ > > use-livecode mailing list > > [email protected] > > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > > http://lists.runrev.com/mailman/listinfo/use-livecode > > > _______________________________________________ > use-livecode mailing list > [email protected] > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode
