I expected that floor(x) would return an integer especially since the docs state:
Return the floor of the input, element-wise.
The floor of the scalar x
is the largest integer i
, such that
i <= x
. It is often denoted as :math:\lfloor x \rfloor
.
Any reason why it returns a float? Bug/feature?
Thanks, Mark
I should have posted this question on the numpy list of course, even though floor is imported with pylab.
Off-list, Felix pointed me to the following discussion where some of the reasons are explained why a float is returned rather than an integer:
http://stackoverflow.com/questions/8582741/why-do-pythons-math-ceil-and-math-floor-operations-return-floats-instead-of
···
On Mon, Mar 31, 2014 at 5:05 PM, Mark Bakker <markbak@…287…> wrote:
I expected that floor(x) would return an integer especially since the docs state:
Return the floor of the input, element-wise.
The floor of the scalar x
is the largest integer i
, such that
i <= x
. It is often denoted as :math:\lfloor x \rfloor
.
Any reason why it returns a float? Bug/feature?
Thanks, Mark