Re: ABS fastest thus far

new topic     » goto parent     » topic index » view thread      » older message » newer message

See..

>--mine, nonrecursive, only sign changes what is needed
>function abs4(object x)
>   if atom(x) then
>        if x<0 then return -x else return x end if
>   end if
>   for index=1 to length(x) do
>     temp = x[index] --this assignment helped vs element lookup
>     if temp<0 then x[index]=-temp end if

*CRASH* ... temp is an sequence. (when x has more than one dimension)

>   end for
>   return x
>end function


And howcome testing for atoms is quicker ?
Is atom () faster than sequence () .. Robert this should never be off
course..
Ralf

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu