1. Re: ABS

Hello,

David Cuny wrote:

>Lewis posted his offering for the ABS function:
>
>>  function abs(object x)
>>      return sqrt(x*x)
>>  end function
>
>I've avoided this discussion up to this point, but I couldn't resist
the
>bait. Getting a function as fast as possible is fine, but you probably
want
>to avoid this approach:
>
>        - It can overflow for large numbers

I agree here, infact sqrt buttons on calculators can accually give you
significantly incorrect answers on large numbers so it wouldn't be good
for this.

>        - It's non-intuitive

This, however, I believe is a matter of oppinion.  I find sqrt"(x*x)"
very intuitive for me while lots of recursion runs me in circles.

Sincerely,
Lewis Townsend

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu