Skip to content

Commit ec1f841

Browse files
committed
Make arange() endpoint-inclusive for -ve step size
1 parent e210c92 commit ec1f841

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

proplot/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ def arange(min_, *args):
168168
# All input is integer
169169
if all(isinstance(val, Integral) for val in (min_, max_, step)):
170170
min_, max_, step = np.int64(min_), np.int64(max_), np.int64(step)
171-
max_ += np.sign(step) * 1
171+
max_ += np.sign(step)
172172
# Input is float or mixed, cast to float64
173173
# Don't use np.nextafter with np.finfo(np.dtype(np.float64)).max, because
174174
# round-off errors from continually adding step to min mess this up
175175
else:
176176
min_, max_, step = np.float64(min_), np.float64(max_), np.float64(step)
177-
max_ += np.sign(step) * (step / 2)
177+
max_ += 0.5 * step
178178
return np.arange(min_, max_, step)
179179

180180

0 commit comments

Comments
 (0)