Opened 8 years ago

Closed 8 years ago

#10938 closed Bugs (fixed)

extreme_value_distribution pdf fails for large deviates

Reported by: Paul McClellan <paulm@…> Owned by: John Maddock
Milestone: To Be Determined Component: math
Version: Boost 1.57.0 Severity: Problem
Keywords: math Cc:

Description

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);

Change History (1)

comment:1 by John Maddock, 8 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.