|
From: Sasha <nd...@ma...> - 2006-02-08 22:47:06
|
On 2/8/06, Robert Kern <rob...@gm...> wrote: > ... > arange() does allow for fractional steps unlinke range(). You may fix the > docstring if you like. However, I don't think it is possible to ensure th= at > invariant in the face of floating point. That's why we have linspace(). There is certainly a way to ensure that arange(..., stop, ...)[-1] < stop in the face of floating point -- just repeat start +=3D step with start in a volatile double variable until it exceeds stop to get the length of the result. There might be an O(1) solution as well, but it may require some assumptions about the floating point unit. In any case, I can do one of the following depending on a vote: 1 (default). Document length=3Dceil((stop - start)/step) in the arange docs= tring 2. Change arange to be a fast equivalent of array(range(start, stop, step), dtype). 3. Change arange to ensure that arange(..., stop, ...)[-1] < stop. Please vote on 1-3. -- sasha |