summaryrefslogtreecommitdiff
path: root/boost/math/distributions/extreme_value.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/math/distributions/extreme_value.hpp')
-rw-r--r--boost/math/distributions/extreme_value.hpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/boost/math/distributions/extreme_value.hpp b/boost/math/distributions/extreme_value.hpp
index ef9fbe817d..4c6b710cbd 100644
--- a/boost/math/distributions/extreme_value.hpp
+++ b/boost/math/distributions/extreme_value.hpp
@@ -108,7 +108,10 @@ inline RealType pdf(const extreme_value_distribution<RealType, Policy>& dist, co
return result;
if(0 == detail::check_x(function, x, &result, Policy()))
return result;
- result = exp((a-x)/b) * exp(-exp((a-x)/b)) / b;
+ RealType e = (a - x) / b;
+ if(e < tools::log_max_value<RealType>())
+ result = exp(e) * exp(-exp(e)) / b;
+ // else.... result *must* be zero since exp(e) is infinite...
return result;
} // pdf