[Numpy-discussion] Timings for various round functions

Travis Oliphant oliphant.travis at ieee.org
Wed Feb 22 22:11:01 CST 2006


Sasha wrote:

>C99 defines three functions round, rint and nearbyint that are nearly
>identical.  The only difference is in setting the inexact flag and
>respecting the rounding mode.  Nevertheless, these functions differ
>significantly in their performance.  I've wraped these functions into
>ufuncs and go the following timings:
>  
>
>Obviously, I will use rint in my ndarray.round implementation,
>however, it may be useful to provide all three as ufuncs.
>
>The only question is what name to use for round?
>
>1) round (may lead to confusion with ndarray.round or built-in round)
>2) roundint (too similar to rint)
>3) round0 (ugly)
>
>Any suggestions?
>
>Another C99 function that may be worth including is "trunc".  Any
>objections to adding it as a ufunc?
>  
>

I think we have agreed that C99 functions are good candidates to become 
ufuncs.  The only problem is figuring out what to do on platforms that 
don't define them. 

For example, we could define a separate module of C99 functions that is 
only available on certain platforms. 

-Travis





More information about the Numpy-discussion mailing list