Nobel
Mark Smith
mark at maseurope.net
Fri Oct 20 09:08:08 EDT 2006
Bill, Thanks - I knew it couldn't possibly be perfect - and your
observations about ABS and trunc are exactly the kind of comment I
hoped the list would supply.
Yours, somewhere between the nobel and the dunces cap,
Mark
On 20 Oct 2006, at 12:14, Bill Marriott wrote:
> Well, you don't need abs() when squaring numbers, and I'm not sure
> why you would use trunc() instead of round().
>
> a^2 + b^2 = c^2 works great for screen dimensions. But if you're
> talking about distances on earth, look at
>
> http://mathforum.org/library/drmath/view/54941.html
>
> Writing a function for that would put you closer to the Nobel.
>
> Mark Smith wrote
> > function pointDistance point1,point2
> >
> > put ABS(item 1 of point1 - item 1 of point2) ^ 2 into square1
> > put ABS(item 2 of point1 - item 2 of point2) ^ 2 into square2
> >
> > return trunc(sqrt(square1 + square2))
> >
> > end pointDistance
>
More information about the use-livecode
mailing list