Boost C++ Libraries: Ticket #10938: extreme_value_distribution pdf fails for large deviates https://svn.boost.org/trac10/ticket/10938 <p> extreme_value_distribution&lt;double&gt; pdf function raises an error when the normalized deviate (a-x)/b is too large positive. </p> <p> For example, when a = 0.0, b = 1.0, and x = -1.0e3 the pdf computation: </p> <pre class="wiki"> result = exp((a-x)/b) * exp(-exp((a-x)/b)) / b; </pre><p> results in the term exp((a-x)/b) = exp(-x) overflowing to +inf, and the term exp(-exp((a-x)/b)) / b = exp(-exp(-x)) underflowing to 0.0 and the product of the terms being indeterminate. </p> <p> My workaround is: </p> <pre class="wiki"> // evmax distribution object: boost::math::extreme_value evmax(dL, dS); // BUGFIX Set pdf(x;a,b) to zero for (a-x)/b &gt; 37. // This avoids an indeterminant computation. return (dL-dX)/dS &gt; 37.0 ? 0.0 : pdf(evmax, dX); </pre><p> </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10938 Trac 1.4.3 John Maddock Thu, 05 Feb 2015 19:03:51 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/10938#comment:1 https://svn.boost.org/trac10/ticket/10938#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed in <a class="ext-link" href="https://github.com/boostorg/math/commit/545961746cb0d67ea20e27de98c459b3ec0ade71"><span class="icon">​</span>https://github.com/boostorg/math/commit/545961746cb0d67ea20e27de98c459b3ec0ade71</a> </p> Ticket