Stéfan van der Walt, 03.10.2010 20:29:
> I got bitten tonight by the following behaviour:
>
> x**4
>
> translates to
>
>    __pyx_r = (pow(__pyx_v_x, 4.0);

That's not true for C integer types (since at least 0.12 IIRC). They 
translate to multiplication code for x**N, N<=3, and to a loop for N>3.

What type does 'x' have in your code? If it's a FP type, then the above is 
the correct way to do it (although a similar optimisation for constant 
exponents may be worth it). If it's an integer type, please double check 
the C code and provide a complete example.

Stefan
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to