From 7ebc78ab86cf6cca4fe27e4f4ba5685cfb4af5cb Mon Sep 17 00:00:00 2001
From: Athan Reines <kgryte@gmail.com>
Date: Wed, 1 May 2024 22:12:07 -0700
Subject: [PATCH] feat: add `reciprocal` to the specification

---
 .../elementwise_functions.rst                 |  1 +
 .../_draft/elementwise_functions.py           | 24 +++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/spec/draft/API_specification/elementwise_functions.rst b/spec/draft/API_specification/elementwise_functions.rst
index 4919cff98..590af9232 100644
--- a/spec/draft/API_specification/elementwise_functions.rst
+++ b/spec/draft/API_specification/elementwise_functions.rst
@@ -70,6 +70,7 @@ Objects in API
    positive
    pow
    real
+   reciprocal
    remainder
    round
    sign
diff --git a/src/array_api_stubs/_draft/elementwise_functions.py b/src/array_api_stubs/_draft/elementwise_functions.py
index 4462329d6..91c0dd835 100644
--- a/src/array_api_stubs/_draft/elementwise_functions.py
+++ b/src/array_api_stubs/_draft/elementwise_functions.py
@@ -52,6 +52,7 @@
     "positive",
     "pow",
     "real",
+    "reciprocal",
     "remainder",
     "round",
     "sign",
@@ -2224,6 +2225,29 @@ def real(x: array, /) -> array:
     """
 
 
+def reciprocal(x: array, /) -> array:
+    """
+    Returns the reciprocal for each element ``x_i`` of the input array ``x``.
+
+    Parameters
+    ----------
+    x: array
+        input array. Should have a floating-point data type.
+
+    Returns
+    -------
+    out: array
+        an array containing the element-wise results. The returned array must have a floating-point data type determined by :ref:`type-promotion`.
+
+    Notes
+    -----
+
+    **Special cases**
+
+    For floating-point operands, special cases must be handled as if the operation is implemented as ``1.0 / x`` (see :func:`~array_api.divide`).
+    """
+
+
 def remainder(x1: array, x2: array, /) -> array:
     """
     Returns the remainder of division for each element ``x1_i`` of the input array ``x1`` and the respective element ``x2_i`` of the input array ``x2``.