Skip to content

Commit c4ab9fe

Browse files
authored
Add specifications for constants and associated element-wise functions (#41)
1 parent bf6e928 commit c4ab9fe

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

spec/API_specification/constants.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Constants
2+
3+
> Array API specification for constants.
4+
5+
A conforming implementation of the array API standard must provide and support the following constants.
6+
7+
<!-- NOTE: please keep the constants in alphabetical order -->
8+
9+
### <a name="e" href="#e">#</a> e
10+
11+
Euler's constant.
12+
13+
```text
14+
e = 2.71828182845904523536028747135266249775724709369995...
15+
```
16+
17+
### <a name="inf" href="#inf">#</a> inf
18+
19+
IEEE 754 floating point representation of (positive) infinity.
20+
21+
### <a name="nan" href="#nan">#</a> nan
22+
23+
IEEE 754 floating point representation of Not a Number (`NaN`).
24+
25+
### <a name="pi" href="#pi">#</a> pi
26+
27+
The mathematical constant `π`.
28+
29+
```text
30+
pi = 3.1415926535897932384626433...
31+
```

spec/API_specification/elementwise_functions.md

+48
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,54 @@ Computes the truth value of `x1_i >= x2_i` for each element `x1_i` of the input
431431

432432
- an array containing the element-wise results.
433433

434+
### <a name="isfinite" href="#isfinite">#</a> isfinite(x, /)
435+
436+
Tests each element `x_i` of the input array `x` to determine if finite (i.e., not `NaN` and not equal to positive or negative infinity).
437+
438+
#### Parameters
439+
440+
- **x**: _&lt;array&gt;_
441+
442+
- input array.
443+
444+
#### Returns
445+
446+
- **out**: _&lt;array&gt;_
447+
448+
- an array, whose underlying data type is `bool`, containing test results. An element `out_i` is `True` if `x_i` is finite and `False` otherwise.
449+
450+
### <a name="isinf" href="#isinf">#</a> isinf(x, /)
451+
452+
Tests each element `x_i` of the input array `x` to determine if equal to positive or negative infinity.
453+
454+
#### Parameters
455+
456+
- **x**: _&lt;array&gt;_
457+
458+
- input array.
459+
460+
#### Returns
461+
462+
- **out**: _&lt;array&gt;_
463+
464+
- an array, whose underlying data type is `bool`, containing test results. An element `out_i` is `True` if `x_i` is either positive or negative infinity and `False` otherwise.
465+
466+
### <a name="isnan" href="#isnan">#</a> isnan(x, /)
467+
468+
Tests each element `x_i` of the input array `x` to determine whether the element is `NaN`.
469+
470+
#### Parameters
471+
472+
- **x**: _&lt;array&gt;_
473+
474+
- input array.
475+
476+
#### Returns
477+
478+
- **out**: _&lt;array&gt;_
479+
480+
- an array, whose underlying data type is `bool`, containing test results. An element `out_i` is `True` if `x_i` is `NaN` and `False` otherwise.
481+
434482
### <a name="less" href="#less">#</a> less(x1, x2, /)
435483

436484
Computes the truth value of `x1_i < x2_i` for each element `x1_i` of the input array `x1` with the respective element `x2_i` of the input array `x2`.

spec/API_specification/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ API specification
1919
linear_algebra_functions
2020
searching_functions
2121
set_functions
22+
constants

0 commit comments

Comments
 (0)