<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">from __future__ import annotations

from ._dtypes import (
    _boolean_dtypes,
    _floating_dtypes,
    _integer_dtypes,
    _integer_or_boolean_dtypes,
    _numeric_dtypes,
    _result_type,
)
from ._array_object import Array

import numpy as np


def abs(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.abs &lt;numpy.abs&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in abs")
    return Array._new(np.abs(x._array))


# Note: the function name is different here
def acos(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.arccos &lt;numpy.arccos&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in acos")
    return Array._new(np.arccos(x._array))


# Note: the function name is different here
def acosh(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.arccosh &lt;numpy.arccosh&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in acosh")
    return Array._new(np.arccosh(x._array))


def add(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.add &lt;numpy.add&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in add")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.add(x1._array, x2._array))


# Note: the function name is different here
def asin(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.arcsin &lt;numpy.arcsin&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in asin")
    return Array._new(np.arcsin(x._array))


# Note: the function name is different here
def asinh(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.arcsinh &lt;numpy.arcsinh&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in asinh")
    return Array._new(np.arcsinh(x._array))


# Note: the function name is different here
def atan(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.arctan &lt;numpy.arctan&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in atan")
    return Array._new(np.arctan(x._array))


# Note: the function name is different here
def atan2(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.arctan2 &lt;numpy.arctan2&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _floating_dtypes or x2.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in atan2")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.arctan2(x1._array, x2._array))


# Note: the function name is different here
def atanh(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.arctanh &lt;numpy.arctanh&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in atanh")
    return Array._new(np.arctanh(x._array))


def bitwise_and(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.bitwise_and &lt;numpy.bitwise_and&gt;`.

    See its docstring for more information.
    """
    if (
        x1.dtype not in _integer_or_boolean_dtypes
        or x2.dtype not in _integer_or_boolean_dtypes
    ):
        raise TypeError("Only integer or boolean dtypes are allowed in bitwise_and")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.bitwise_and(x1._array, x2._array))


# Note: the function name is different here
def bitwise_left_shift(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.left_shift &lt;numpy.left_shift&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _integer_dtypes or x2.dtype not in _integer_dtypes:
        raise TypeError("Only integer dtypes are allowed in bitwise_left_shift")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    # Note: bitwise_left_shift is only defined for x2 nonnegative.
    if np.any(x2._array &lt; 0):
        raise ValueError("bitwise_left_shift(x1, x2) is only defined for x2 &gt;= 0")
    return Array._new(np.left_shift(x1._array, x2._array))


# Note: the function name is different here
def bitwise_invert(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.invert &lt;numpy.invert&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _integer_or_boolean_dtypes:
        raise TypeError("Only integer or boolean dtypes are allowed in bitwise_invert")
    return Array._new(np.invert(x._array))


def bitwise_or(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.bitwise_or &lt;numpy.bitwise_or&gt;`.

    See its docstring for more information.
    """
    if (
        x1.dtype not in _integer_or_boolean_dtypes
        or x2.dtype not in _integer_or_boolean_dtypes
    ):
        raise TypeError("Only integer or boolean dtypes are allowed in bitwise_or")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.bitwise_or(x1._array, x2._array))


# Note: the function name is different here
def bitwise_right_shift(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.right_shift &lt;numpy.right_shift&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _integer_dtypes or x2.dtype not in _integer_dtypes:
        raise TypeError("Only integer dtypes are allowed in bitwise_right_shift")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    # Note: bitwise_right_shift is only defined for x2 nonnegative.
    if np.any(x2._array &lt; 0):
        raise ValueError("bitwise_right_shift(x1, x2) is only defined for x2 &gt;= 0")
    return Array._new(np.right_shift(x1._array, x2._array))


def bitwise_xor(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.bitwise_xor &lt;numpy.bitwise_xor&gt;`.

    See its docstring for more information.
    """
    if (
        x1.dtype not in _integer_or_boolean_dtypes
        or x2.dtype not in _integer_or_boolean_dtypes
    ):
        raise TypeError("Only integer or boolean dtypes are allowed in bitwise_xor")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.bitwise_xor(x1._array, x2._array))


def ceil(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.ceil &lt;numpy.ceil&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in ceil")
    if x.dtype in _integer_dtypes:
        # Note: The return dtype of ceil is the same as the input
        return x
    return Array._new(np.ceil(x._array))


def cos(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.cos &lt;numpy.cos&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in cos")
    return Array._new(np.cos(x._array))


def cosh(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.cosh &lt;numpy.cosh&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in cosh")
    return Array._new(np.cosh(x._array))


def divide(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.divide &lt;numpy.divide&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _floating_dtypes or x2.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in divide")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.divide(x1._array, x2._array))


def equal(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.equal &lt;numpy.equal&gt;`.

    See its docstring for more information.
    """
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.equal(x1._array, x2._array))


def exp(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.exp &lt;numpy.exp&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in exp")
    return Array._new(np.exp(x._array))


def expm1(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.expm1 &lt;numpy.expm1&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in expm1")
    return Array._new(np.expm1(x._array))


def floor(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.floor &lt;numpy.floor&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in floor")
    if x.dtype in _integer_dtypes:
        # Note: The return dtype of floor is the same as the input
        return x
    return Array._new(np.floor(x._array))


def floor_divide(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.floor_divide &lt;numpy.floor_divide&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in floor_divide")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.floor_divide(x1._array, x2._array))


def greater(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.greater &lt;numpy.greater&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in greater")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.greater(x1._array, x2._array))


def greater_equal(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.greater_equal &lt;numpy.greater_equal&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in greater_equal")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.greater_equal(x1._array, x2._array))


def isfinite(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.isfinite &lt;numpy.isfinite&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in isfinite")
    return Array._new(np.isfinite(x._array))


def isinf(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.isinf &lt;numpy.isinf&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in isinf")
    return Array._new(np.isinf(x._array))


def isnan(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.isnan &lt;numpy.isnan&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in isnan")
    return Array._new(np.isnan(x._array))


def less(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.less &lt;numpy.less&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in less")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.less(x1._array, x2._array))


def less_equal(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.less_equal &lt;numpy.less_equal&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in less_equal")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.less_equal(x1._array, x2._array))


def log(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.log &lt;numpy.log&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in log")
    return Array._new(np.log(x._array))


def log1p(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.log1p &lt;numpy.log1p&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in log1p")
    return Array._new(np.log1p(x._array))


def log2(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.log2 &lt;numpy.log2&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in log2")
    return Array._new(np.log2(x._array))


def log10(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.log10 &lt;numpy.log10&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in log10")
    return Array._new(np.log10(x._array))


def logaddexp(x1: Array, x2: Array) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.logaddexp &lt;numpy.logaddexp&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _floating_dtypes or x2.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in logaddexp")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.logaddexp(x1._array, x2._array))


def logical_and(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.logical_and &lt;numpy.logical_and&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _boolean_dtypes or x2.dtype not in _boolean_dtypes:
        raise TypeError("Only boolean dtypes are allowed in logical_and")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.logical_and(x1._array, x2._array))


def logical_not(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.logical_not &lt;numpy.logical_not&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _boolean_dtypes:
        raise TypeError("Only boolean dtypes are allowed in logical_not")
    return Array._new(np.logical_not(x._array))


def logical_or(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.logical_or &lt;numpy.logical_or&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _boolean_dtypes or x2.dtype not in _boolean_dtypes:
        raise TypeError("Only boolean dtypes are allowed in logical_or")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.logical_or(x1._array, x2._array))


def logical_xor(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.logical_xor &lt;numpy.logical_xor&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _boolean_dtypes or x2.dtype not in _boolean_dtypes:
        raise TypeError("Only boolean dtypes are allowed in logical_xor")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.logical_xor(x1._array, x2._array))


def multiply(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.multiply &lt;numpy.multiply&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in multiply")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.multiply(x1._array, x2._array))


def negative(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.negative &lt;numpy.negative&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in negative")
    return Array._new(np.negative(x._array))


def not_equal(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.not_equal &lt;numpy.not_equal&gt;`.

    See its docstring for more information.
    """
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.not_equal(x1._array, x2._array))


def positive(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.positive &lt;numpy.positive&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in positive")
    return Array._new(np.positive(x._array))


# Note: the function name is different here
def pow(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.power &lt;numpy.power&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in pow")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.power(x1._array, x2._array))


def remainder(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.remainder &lt;numpy.remainder&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in remainder")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.remainder(x1._array, x2._array))


def round(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.round &lt;numpy.round&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in round")
    return Array._new(np.round(x._array))


def sign(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.sign &lt;numpy.sign&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in sign")
    return Array._new(np.sign(x._array))


def sin(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.sin &lt;numpy.sin&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in sin")
    return Array._new(np.sin(x._array))


def sinh(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.sinh &lt;numpy.sinh&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in sinh")
    return Array._new(np.sinh(x._array))


def square(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.square &lt;numpy.square&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in square")
    return Array._new(np.square(x._array))


def sqrt(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.sqrt &lt;numpy.sqrt&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in sqrt")
    return Array._new(np.sqrt(x._array))


def subtract(x1: Array, x2: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.subtract &lt;numpy.subtract&gt;`.

    See its docstring for more information.
    """
    if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in subtract")
    # Call result type here just to raise on disallowed type combinations
    _result_type(x1.dtype, x2.dtype)
    x1, x2 = Array._normalize_two_args(x1, x2)
    return Array._new(np.subtract(x1._array, x2._array))


def tan(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.tan &lt;numpy.tan&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in tan")
    return Array._new(np.tan(x._array))


def tanh(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.tanh &lt;numpy.tanh&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _floating_dtypes:
        raise TypeError("Only floating-point dtypes are allowed in tanh")
    return Array._new(np.tanh(x._array))


def trunc(x: Array, /) -&gt; Array:
    """
    Array API compatible wrapper for :py:func:`np.trunc &lt;numpy.trunc&gt;`.

    See its docstring for more information.
    """
    if x.dtype not in _numeric_dtypes:
        raise TypeError("Only numeric dtypes are allowed in trunc")
    if x.dtype in _integer_dtypes:
        # Note: The return dtype of trunc is the same as the input
        return x
    return Array._new(np.trunc(x._array))
</pre></body></html>