[Boost-bugs] [Boost C++ Libraries] #10938: extreme_value_distribution pdf fails for large deviates

Subject: [Boost-bugs] [Boost C++ Libraries] #10938: extreme_value_distribution pdf fails for large deviates
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-01-18 03:39:15


#10938: extreme_value_distribution pdf fails for large deviates
--------------------------------------+-------------------------
 Reporter: Paul McClellan <paulm@…> | Owner: johnmaddock
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: math
  Version: Boost 1.57.0 | Severity: Problem
 Keywords: math |
--------------------------------------+-------------------------
 extreme_value_distribution<double> pdf function raises an error when the
 normalized deviate (a-x)/b is too large positive.

 For example, when a = 0.0, b = 1.0, and x = -1.0e3 the pdf computation:

 {{{
   result = exp((a-x)/b) * exp(-exp((a-x)/b)) / b;
 }}}

 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.

 My workaround is:

 {{{
   // evmax distribution object:
   boost::math::extreme_value evmax(dL, dS);
   // BUGFIX Set pdf(x;a,b) to zero for (a-x)/b > 37.
   // This avoids an indeterminant computation.
   return (dL-dX)/dS > 37.0 ? 0.0 : pdf(evmax, dX);
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/10938>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:17 UTC