diff --git a/spec/API_specification/constants.md b/spec/API_specification/constants.md new file mode 100644 index 000000000..acb214ef0 --- /dev/null +++ b/spec/API_specification/constants.md @@ -0,0 +1,31 @@ +# Constants + +> Array API specification for constants. + +A conforming implementation of the array API standard must provide and support the following constants. + + + +### # e + +Euler's constant. + +```text +e = 2.71828182845904523536028747135266249775724709369995... +``` + +### # inf + +IEEE 754 floating point representation of (positive) infinity. + +### # nan + +IEEE 754 floating point representation of Not a Number (`NaN`). + +### # pi + +The mathematical constant `π`. + +```text +pi = 3.1415926535897932384626433... +``` \ No newline at end of file diff --git a/spec/API_specification/elementwise_functions.md b/spec/API_specification/elementwise_functions.md index 23eb56379..d9e1ff6e4 100644 --- a/spec/API_specification/elementwise_functions.md +++ b/spec/API_specification/elementwise_functions.md @@ -431,6 +431,54 @@ Computes the truth value of `x1_i >= x2_i` for each element `x1_i` of the input - an array containing the element-wise results. +### # isfinite(x, /) + +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). + +#### Parameters + +- **x**: _<array>_ + + - input array. + +#### Returns + +- **out**: _<array>_ + + - 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. + +### # isinf(x, /) + +Tests each element `x_i` of the input array `x` to determine if equal to positive or negative infinity. + +#### Parameters + +- **x**: _<array>_ + + - input array. + +#### Returns + +- **out**: _<array>_ + + - 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. + +### # isnan(x, /) + +Tests each element `x_i` of the input array `x` to determine whether the element is `NaN`. + +#### Parameters + +- **x**: _<array>_ + + - input array. + +#### Returns + +- **out**: _<array>_ + + - 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. + ### # less(x1, x2, /) 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`. diff --git a/spec/API_specification/index.rst b/spec/API_specification/index.rst index 3d16132df..46b7c9366 100644 --- a/spec/API_specification/index.rst +++ b/spec/API_specification/index.rst @@ -19,3 +19,4 @@ API specification linear_algebra_functions searching_functions set_functions + constants