[Numpy-discussion] Rookie problems - Why is C-code much faster?

Pau Gargallo pau.gargallo at gmail.com
Tue Feb 21 08:02:07 CST 2006


> the closest integer, i.e. for x = array([1.1, 1.8])
>
>   around(x) = [1.0, 2.0]
>
> whereas
>
>   x.astype(int).astype(float) = [1.0, 1.0]
>
(x+0.5).astype(int).astype(float) = [1.0, 2.0]

i hope it helps,
pau




More information about the Numpy-discussion mailing list