Reproducing code example:
For some reason, np.left_shift(np.array([0], dtype=np.int16), np.array([[31, 31, 31], [31, 31, 31], [31, 31, 31]], dtype=np.int16)) gives a floating point warning, but similar function calls do not.
>>> np.seterr(all='raise')
{'divide': 'warn', 'over': 'warn', 'under': 'ignore', 'invalid': 'warn'}
>>> np.left_shift(np.array([0], dtype=np.int8), np.array([31], dtype=np.int16))
array([0], dtype=int16)
>>> np.left_shift(np.array([0], dtype=np.int16), np.array([31], dtype=np.int16))
array([0], dtype=int16)
>>> np.left_shift(np.array([0], dtype=np.int16), np.array([[31, 31, 31]], dtype=np.int16))
array([[0, 0, 0]], dtype=int16)
>>> np.left_shift(np.array([0], dtype=np.int16), np.array([[31, 31, 31], [31, 31, 31]], dtype=np.int16))
array([[0, 0, 0],
[0, 0, 0]], dtype=int16)
>>> np.left_shift(np.array([0], dtype=np.int16), np.array([[31, 31, 31], [31, 31, 31], [31, 31, 31]], dtype=np.int16))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
FloatingPointError: invalid value encountered in left_shift
>>> np.left_shift(np.array([0], dtype=np.int16), np.array([[30, 30, 30], [30, 30, 30], [30, 30, 30]], dtype=np.int16))
array([[0, 0, 0],
[0, 0, 0],
[0, 0, 0]], dtype=int16)
Error message:
NumPy/Python version information:
>>> np.__version__
'1.21.0.dev0+1549.g7c4b2482a'
>>> import sys
>>> sys.version
'3.9.2 | packaged by conda-forge | (default, Feb 21 2021, 05:02:20) \n[Clang 11.0.1 ]'
Reproducing code example:
For some reason, np.left_shift(np.array([0], dtype=np.int16), np.array([[31, 31, 31], [31, 31, 31], [31, 31, 31]], dtype=np.int16)) gives a floating point warning, but similar function calls do not.
Error message:
NumPy/Python version information: