Re: Rounding Was: Re: intersection and ExoticaX

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

Yes, indeed, why not...
Thanks, Carl.

jiri

----- Original Message ----- 
From: <euphoria at carlw.legend.uk.com>
To: "EUforum" <EUforum at topica.com>
Subject: Rounding Was: Re: intersection and ExoticaX


> 
> 
> Jiri wrote:
> 
> > function round(object x)                -- recursive
> >     if atom(x) then
> >         return floor(x+0.5)
> >     end if
> >     for i=1 to length(x) do
> >         x[i] = round(x[i])
> >     end for
> >     return x
> > end function
> 
> Okay, I'll bite.
> 
> Why not just:
> 
>   function round(object x)
>       return floor(x+.5)
>   end function
> 
> ...? floor() is usable on sequences after all, as is adding 0.5.
> 
> It's faster by 30ish% too.
> 
> Or am I asking for trouble posting this sort of thing again. blink
> 
> Cowering in the corner,
> Carl
> 
> -- 
> Carl R White - aka - Cyrek
> eMail: carlw at legend.co.uk
>        cyrek at bigfoot.com
> URL:   nope none nada zip
> 
> 
> 
> 
> 
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu