Skip to content

Commit bb17b5e

Browse files
improve where call
Co-authored-by: jakirkham <[email protected]>
1 parent 1fe453f commit bb17b5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/array_api_extra/_funcs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,5 +426,5 @@ def sinc(x: Array, /, *, xp: ModuleType) -> Array:
426426
if not xp.isdtype(x.dtype, "real floating"):
427427
err_msg = "`x` must have a real floating data type."
428428
raise ValueError(err_msg)
429-
y = xp.pi * xp.where(x == 0, xp.asarray(1.0e-20), x)
429+
y = xp.pi * xp.where(x, x, xp.finfo(x.dtype).smallest_normal)
430430
return xp.sin(y) / y

0 commit comments

Comments
 (0)