Skip to content

Commit f31fc5c

Browse files
committed
Update specification for arange
Addresses comments in data-apisgh-85 and data-apisgh-107
1 parent 0cbbfea commit f31fc5c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

spec/API_specification/creation_functions.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A conforming implementation of the array API standard must provide and support t
1212
<!-- NOTE: please keep the functions in alphabetical order -->
1313

1414
(function-arange)=
15-
### arange(start, /, *, stop=None, step=1, dtype=None, device=None)
15+
### arange(start, /, stop=None, step=1, *, dtype=None, device=None)
1616

1717
Returns evenly spaced values within the half-open interval `[start, stop)` as a one-dimensional array.
1818

@@ -33,11 +33,11 @@ This function cannot guarantee that the interval does not include the `stop` val
3333

3434
- **step**: _Union\[ int, float ]_
3535

36-
- the distance between two adjacent elements (`out[i+1] - out[i]`). Default: `1`.
36+
- the distance between two adjacent elements (`out[i+1] - out[i]`). Must not be `0`; may be negative, this results in an empty array if `stop >= start`. Default: `1`.
3737

3838
- **dtype**: _Optional\[ &lt;dtype&gt; ]_
3939

40-
- output array data type. If `dtype` is `None`, the output array data type must be the default floating-point data type. Default: `None`.
40+
- output array data type. If `dtype` is `None`, the output array data type must be inferred from `start`, `stop` and `step`. If those are all integers, the output array dtype must be the default integer dtype; if one or more have type `float`, then the output array dtype must be the default floating-point data type. Default: `None`.
4141

4242
- **device**: _Optional\[ &lt;device&gt; ]_
4343

@@ -47,7 +47,7 @@ This function cannot guarantee that the interval does not include the `stop` val
4747

4848
- **out**: _&lt;array&gt;_
4949

50-
- a one-dimensional array containing evenly spaced values. The length of the output array must be `ceil((stop-start)/step)`.
50+
- a one-dimensional array containing evenly spaced values. The length of the output array must be `ceil((stop-start)/step)` if `stop - start` and `step` have the same sign, and length 0 otherwise.
5151

5252

5353
(function-asarray)=

0 commit comments

Comments
 (0)