Skip to content

Commit b18a1b6

Browse files
committed
ENH: real and conj accept numeric dtypes
1 parent 590a2de commit b18a1b6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

array_api_strict/_elementwise_functions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ def conj(x: Array, /) -> Array:
378378
379379
See its docstring for more information.
380380
"""
381-
if x.dtype not in _complex_floating_dtypes:
382-
raise TypeError("Only complex floating-point dtypes are allowed in conj")
381+
if x.dtype not in _numeric_dtypes:
382+
raise TypeError("Only numeric dtypes are allowed in conj")
383383
return Array._new(np.conj(x._array), device=x.device)
384384

385385

@@ -568,8 +568,8 @@ def real(x: Array, /) -> Array:
568568
569569
See its docstring for more information.
570570
"""
571-
if x.dtype not in _complex_floating_dtypes:
572-
raise TypeError("Only complex floating-point dtypes are allowed in real")
571+
if x.dtype not in _numeric_dtypes:
572+
raise TypeError("Only numeric dtypes are allowed in real")
573573
return Array._new(np.real(x._array), device=x.device)
574574

575575

0 commit comments

Comments
 (0)