BUG: Fix handling of the dtype parameter to numpy.array_api.prod()
@@ -65,8 +65,8 @@ def prod(
# Note: sum() and prod() always upcast float32 to float64 for dtype=None
# We need to do so here before computing the product to avoid overflow
if dtype is None and x.dtype == float32:
- x = asarray(x, dtype=float64)
- return Array._new(np.prod(x._array, axis=axis, keepdims=keepdims))
+ dtype = float64
+ return Array._new(np.prod(x._array, dtype=dtype, axis=axis, keepdims=keepdims))
def std(
