[NumPy-Tickets] [NumPy] #1564: numpy.arange returns array with wrong length

NumPy Trac numpy-tickets@scipy....
Wed Jul 28 12:41:42 CDT 2010


#1564: numpy.arange returns array with wrong length
---------------------------+------------------------------------------------
 Reporter:  crassus        |       Owner:  somebody
     Type:  defect         |      Status:  new     
 Priority:  high           |   Milestone:  1.5.0   
Component:  numpy.core     |     Version:  1.3.0   
 Keywords:  arange length  |  
---------------------------+------------------------------------------------
 I'm running the scipy package within a VM for sage http://sagemath.org/
 numpy.version.version: 1.3.0 CPU: Intel i7

 Under certain circumstances numpy.arange returns an array that contains
 the stop-parameter. But according to the docs:

 stop : number
 End of interval.  The interval does not include this value


 Here is the example

 Works fine:
 {{{
 ydat= numpy.zeros(970)

 step= float(1.0/400000)
 xdat= numpy.arange(0, len(ydat)*step, step)

 print len(ydat)
 print len(xdat)
 print xdat[-1]==len(ydat)*step
 }}}


 Bug:
 {{{
 ydat= numpy.zeros(971)

 step= float(1.0/400000)
 xdat= numpy.arange(0, len(ydat)*step, step)

 print len(ydat)
 print len(xdat)
 print xdat[-1]==len(ydat)*step
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1564>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list