scipy.integrate.quad FloatingPointError on integration
<p>I'm trying to perform the integration of f(x) = 42*log(2)*2^(-t) from x = zero to t for different values of t as follows:</p>

<pre><code>import numpy as np
from scipy.integrate import quad
reward = lambda t: 41*np.log(2)*np.power(2,-t)
quad(reward, 0, t)
</code></pre>

<p>However, sometimes I get a underflow FloatingPointError for <code>t=13713.773637630298</code>.  If I do this in an interactive session, I see the following (which does not produce an underflow error):</p>

<pre><code># Sanity Checks
&gt;&gt;&gt; quad(reward, 0, 0)
(0.0, 0.0)
&gt;&gt;&gt; quad(reward, 0, np.inf)
(40.99999999999978, 1.2750366198868279e-07)
# Weird Stuff
&gt;&gt;&gt; quad(reward, 0, 13000)
(41.00000000000001, 4.661522155502418e-07)
&gt;&gt;&gt; quad(reward 0, 130000)
(3.511099523711482e-39, 6.981138006465757e-39)
</code></pre>

<p>My questions are:</p>

<ul>
<li>Why does the value approach zero for increasing values of t?</li>
<li>Why do I get an underflow error when I run the module outside interactive mode, which I am unable to reproduce with an interactive session?</li>
</ul>

<p>Related:
<a href="https://stackoverflow.com/q/30913664/3865495">scipy.integrate.quad gives wrong result on large ranges</a></p>