[Numpy-discussion] numpy.floor() is supposed to return an int, but returns a float

Tim Hochberg tim.hochberg at cox.net
Sun Apr 9 15:30:02 CDT 2006

Webb Sprague wrote:

>Could someone explain this behavior:
>In [13]: type(N.floor(1))
>Out[13]: <type 'float64scalar'>
>In [14]: N.floor?
>Type:           ufunc
>String Form:    <ufunc 'floor'>
>Namespace:      Interactive
>    y = floor(x) elementwise largest integer <= x
>I wouldn't complain, except the only time I use floor() is to make
>indices (dividing ages by age widths, for example).
Well, floor returns an integer, but not an int -- it's an integral 
floating point value. What you want is:

(If you're only using scalars, you might also consider int(floor(x)) 



>This SF.Net email is sponsored by xPML, a groundbreaking scripting language
>that extends applications into web and mobile media. Attend the live webcast
>and join the prime developer group breaking into this new coding territory!
>Numpy-discussion mailing list
>Numpy-discussion at lists.sourceforge.net

More information about the Numpy-discussion mailing list