At 6:15 PM -0700 7/10/02, Brent Dax wrote: >Nicholas Clark: ># On Wed, Jul 10, 2002 at 10:17:47AM -0700, John Porter wrote: ># > ># > Dan Sugalski wrote: ># ># > > Heh. I never expected to have to dust off my trig skills when I ># > > started this. If I need to dig out the calculus books, I ># think I'll ># > > just go run screaming... ># > ># > Not to worry. There's no trig involved. Just the Pythagorean ># > theorem. ># ># Unless I'm being thick, x" < y" whenever x < y for positive x ># and y (ie you don't need to take the square root of the ># hypotenuse to work out which hypotenuse is shorter. And all ># we're actually interested in which one is shorter, aren't we?) > > >Assuming x and y are integers, yes. Which'll probably be all we ever >deal with, so for all intents and purposes you're correct.
We can also be dumb and just compare a^2+b^2. It's integer multiplication, so it should be rather quick, and if anyone has a class hierarchy so deep that the math overflows a 32 bit int, well, they deserve what they get. :) -- Dan --------------------------------------"it's like this"------------------- Dan Sugalski even samurai [EMAIL PROTECTED] have teddy bears and even teddy bears get drunk