2006/6/4, Elliot Temple <curi / curi.us>: > > On Jun 3, 2006, at 6:17 PM, Ray Baxter wrote: > > > Alder Green wrote: > > > >> For example: check if integer i is a power of 2, with an > >> expression no > >> more than 13 characters long. > >> Solution: (i & (i - 1)) > > > > 0 is a power of 2? > > 2^negative_infinity Wow, this actuall works in Ruby: irb(main):004:0> -1.0/0 => -Infinity irb(main):007:0> 2 ** (-1.0/0) => 0.0 > add a special case if you like. ... and violate the 13 character constraint. :-) robert -- Have a look: http://www.flickr.com/photos/fussel-foto/