diff --git a/spec/API_specification/constants.md b/spec/API_specification/constants.md deleted file mode 100644 index 78cdc8de7..000000000 --- a/spec/API_specification/constants.md +++ /dev/null @@ -1,39 +0,0 @@ -# Constants - -> Array API specification for constants. - -A conforming implementation of the array API standard must provide and support the following constants adhering to the following conventions. - -- Each constant must have a Python floating-point data type (i.e., `float`) and be provided as a Python scalar value. - - - -## Objects in API - -(constant-e)= -### e - -IEEE 754 floating-point representation of Euler's constant. - -```text -e = 2.71828182845904523536028747135266249775724709369995... -``` - -(constant-inf)= -### inf - -IEEE 754 floating-point representation of (positive) infinity. - -(constant-nan)= -### nan - -IEEE 754 floating-point representation of Not a Number (`NaN`). - -(constant-pi)= -### pi - -IEEE 754 floating-point representation of the mathematical constant `π`. - -```text -pi = 3.1415926535897932384626433... -``` diff --git a/spec/API_specification/constants.rst b/spec/API_specification/constants.rst new file mode 100644 index 000000000..eab159c9d --- /dev/null +++ b/spec/API_specification/constants.rst @@ -0,0 +1,24 @@ +Constants +========= + + Array API specification for constants. + +A conforming implementation of the array API standard must provide and support the following constants adhering to the following conventions. + +- Each constant must have a Python floating-point data type (i.e., ``float``) and be provided as a Python scalar value. + +Objects in API +-------------- + +.. currentmodule:: signatures.constants + +.. + NOTE: please keep the functions in alphabetical order + +.. autosummary:: + :toctree: generated + + e + inf + nan + pi diff --git a/spec/API_specification/signatures/constants.py b/spec/API_specification/signatures/constants.py new file mode 100644 index 000000000..813b6d079 --- /dev/null +++ b/spec/API_specification/signatures/constants.py @@ -0,0 +1,25 @@ +e = 2.718281828459045 +""" +IEEE 754 floating-point representation of Euler's constant. + +``e = 2.71828182845904523536028747135266249775724709369995...`` +""" + +inf = float('inf') +""" +IEEE 754 floating-point representation of (positive) infinity. +""" + +nan = float('nan') +""" +IEEE 754 floating-point representation of Not a Number (``NaN``). +""" + +pi = 3.141592653589793 +""" +IEEE 754 floating-point representation of the mathematical constant ``π``. + +``pi = 3.1415926535897932384626433...`` +""" + +__all__ = ['e', 'inf', 'nan', 'pi']