I read about double scalar but just partly understand. From my understanding, it is the range that is available to calculate by Numpy. That's why most questions here focusing on the division by zero (which is an error because the answer will be out of range (infinity)).
But I am so unsure that my understanding is correct. Also, I can't see other causes about RuntimeWarning:overflow
encountered in double_scalars. What can cause overflow encountered in double scalars?
Overflow error implies that an operation yields a value out of the range defined for the corresponding data type. For numpy double, that range is (-1.79769313486e+308, 1.79769313486e+308)
. Also, for a good discussion, please read this SO post.
Example:
import numpy as np
np.seterr(all='warn')
print "Range of numpy double:", np.finfo(np.double).min, np.finfo(np.double).max
A = np.array([143],dtype='double')
a=A[-1]
print "At the border:", a**a
B = np.array([144],dtype='double')
b=B[-1]
print "Blowing out of range:", b**b
Output:
Range of numpy double: -1.79769313486e+308 1.79769313486e+308
At the border: 1.6332525973e+308
Blowing out of range: inf
D:\anaconda\lib\site-packages\ipykernel\__main__.py:9: RuntimeWarning: overflow encountered in double_scalars
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With