![](https://secure.gravatar.com/avatar/cd02246b608f6db649022b3a571954ed.jpg?s=120&d=mm&r=g)
Hi All, I use numpy 1.4.1 on Debian squeeze amd64. I noticed that ceil() is not working properly. If the input to ceil() is a float I expect a float to be returned but for inputs in (-1.0, 0.0) the result is of type integer. In [65]: np.__version__ Out[65]: '1.4.1' In [66]: np.ceil(-1.1) Out[66]: -1.0 In [67]: np.ceil(-0.734) Out[67]: -0 In [68]: np.ceil(-0.256) Out[68]: -0 In [69]: np.ceil(-0.0) Out[69]: -0 In [70]: np.ceil(0.2) Out[70]: 1.0 Best wishes Christian -- Dipl.-Ing. Christian Fischer Institute of Engineering and Computational Mechanics (name in German: Institut für Technische und Numerische Mechanik) University of Stuttgart, Pfaffenwaldring 9, 70569 Stuttgart, Germany mailto:cfischer@itm.uni-stuttgart.de, tel 0711-685-66565, fax -66400 http://www.itm.uni-stuttgart.de/staff/Fischer
![](https://secure.gravatar.com/avatar/701339807c926aa651f593e8b06259cd.jpg?s=120&d=mm&r=g)
Are you sure? In [4]: type(np.ceil(-0.0)) Out[4]: <type 'numpy.float64'> Mike On 10/06/2010 01:55 PM, Christian Fischer wrote:
Hi All,
I use numpy 1.4.1 on Debian squeeze amd64.
I noticed that ceil() is not working properly.
If the input to ceil() is a float I expect a float to be returned but for inputs in (-1.0, 0.0) the result is of type integer.
In [65]: np.__version__ Out[65]: '1.4.1'
In [66]: np.ceil(-1.1) Out[66]: -1.0
In [67]: np.ceil(-0.734) Out[67]: -0
In [68]: np.ceil(-0.256) Out[68]: -0
In [69]: np.ceil(-0.0) Out[69]: -0
In [70]: np.ceil(0.2) Out[70]: 1.0
Best wishes Christian
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
-- Michael Droettboom Science Software Branch Space Telescope Science Institute Baltimore, Maryland, USA
![](https://secure.gravatar.com/avatar/96dd777e397ab128fedab46af97a3a4a.jpg?s=120&d=mm&r=g)
On Wed, Oct 6, 2010 at 11:55 AM, Christian Fischer < cfischer@itm.uni-stuttgart.de> wrote:
Hi All,
I use numpy 1.4.1 on Debian squeeze amd64.
I noticed that ceil() is not working properly.
If the input to ceil() is a float I expect a float to be returned but for inputs in (-1.0, 0.0) the result is of type integer.
In [65]: np.__version__ Out[65]: '1.4.1'
In [66]: np.ceil(-1.1) Out[66]: -1.0
In [67]: np.ceil(-0.734) Out[67]: -0
In [68]: np.ceil(-0.256) Out[68]: -0
In [69]: np.ceil(-0.0) Out[69]: -0
In [70]: np.ceil(0.2) Out[70]: 1.0
The -0 is a float type, you can't get it with integers. The printing might could be tweaked to return -0.0, which would be less misleading. The thing that bothers me is that -0 is returned instead of 0.0, but that can be fixed. In [2]: ceil(-.5) Out[2]: -0 In [3]: ceil(-.5) + 0 Out[3]: 0.0 Please open a ticket, maybe two. Chuck
![](https://secure.gravatar.com/avatar/612395b66b3e7959997007b342b3688a.jpg?s=120&d=mm&r=g)
On Wed, 06 Oct 2010 19:55:00 +0200 Christian Fischer <cfischer@itm.uni-stuttgart.de> wrote:
Hi All,
I use numpy 1.4.1 on Debian squeeze amd64.
I noticed that ceil() is not working properly.
If the input to ceil() is a float I expect a float to be returned but for inputs in (-1.0, 0.0) the result is of type integer.
In [65]: np.__version__ Out[65]: '1.4.1'
In [66]: np.ceil(-1.1) Out[66]: -1.0
In [67]: np.ceil(-0.734) Out[67]: -0
In [68]: np.ceil(-0.256) Out[68]: -0
In [69]: np.ceil(-0.0) Out[69]: -0
In [70]: np.ceil(0.2) Out[70]: 1.0
Best wishes Christian
It's a float
type(numpy.ceil(-0.4)) <type 'numpy.float64'> numpy.ceil(-0.4) -0
Nils
participants (4)
-
Charles R Harris
-
Christian Fischer
-
Michael Droettboom
-
Nils Wagner