I am taking the dot-product of two numpy arrays (both float32). I am deliberately setting numpy to raise a FloatingPointError in case of overflow. However, dot does not behave as expected: instead of raising a FloatingPointError as it does when using ordinary multiplication, dot returns inf.
Is this the intended behavior? Is there a way to force dot to raise an exception as well?
Minimal working example:
import numpy as np
np.seterr(over="raise")
x = np.array([2e+38], dtype=np.float32)
y = np.array([10], dtype=np.float32)
x * y
>>> FloatingPointError: overflow encountered in multiply
np.dot(x,y)
>>> inf