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

Robert Kern robert.kern at gmail.com
Sun Apr 9 15:46:04 CDT 2006

Webb Sprague wrote:
> If there is a explanation as to why an integral valued float is a
> better return value, I would be interested in a link.

In [4]: import numpy

In [5]: numpy.floor(2.**50)
Out[5]: 1125899906842624.0

In [6]: numpy.floor(2.**50).astype(int)
Out[6]: 2147483647

Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the Numpy-discussion mailing list