summaryrefslogtreecommitdiff
path: root/numpy/_array_api/_elementwise_functions.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/_array_api/_elementwise_functions.py')
-rw-r--r--numpy/_array_api/_elementwise_functions.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/numpy/_array_api/_elementwise_functions.py b/numpy/_array_api/_elementwise_functions.py
index 67fb7034d..7833ebe54 100644
--- a/numpy/_array_api/_elementwise_functions.py
+++ b/numpy/_array_api/_elementwise_functions.py
@@ -653,4 +653,7 @@ def trunc(x: Array, /) -> Array:
"""
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))