Skip to content

Commit 9ce01a9

Browse files
authored
Apply suggestions from code review
1 parent bb17b5e commit 9ce01a9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/array_api_extra/_funcs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ def sinc(x: Array, /, *, xp: ModuleType) -> Array:
362362
363363
Note the normalization factor of ``pi`` used in the definition.
364364
This is the most commonly used definition in signal processing.
365-
Use ``sinc(x / np.pi)`` to obtain the unnormalized sinc function
365+
Use ``sinc(x / xp.pi)`` to obtain the unnormalized sinc function
366366
:math:`\sin(x)/x` that is more common in mathematics.
367367
368368
Parameters
@@ -426,5 +426,6 @@ 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, x, xp.finfo(x.dtype).smallest_normal)
429+
# no scalars in `where` - array-api#807
430+
y = xp.pi * xp.where(x, x, xp.asarray(xp.finfo(x.dtype).smallest_normal))
430431
return xp.sin(y) / y

0 commit comments

Comments
 (0)