31 ValueType tau = std::numeric_limits<ValueType>::min();
32 ValueType omega = std::numeric_limits<ValueType>::max();
33 ValueType
const sqrt_2_pi = boost::math::constants::root_two_pi<ValueType>();
34 ValueType
const log10_e = std::log10(boost::math::constants::e<ValueType>());
36 uint64_t m =
static_cast<uint64_t
>(lambda);
52 STORM_LOG_WARN(
"Fox-Glynn: 0 < lambda < 25, underflow near Poi(" << lambda <<
", 0) = " << std::exp(-lambda) <<
". The results are unreliable.");
60 ValueType
const bl = (1 + 1 / lambda) * std::exp((1 / lambda) * 0.125);
61 ValueType
const sqrt_lambda = std::sqrt(lambda);
71 left = m -
static_cast<int64_t
>(std::ceil(k * sqrt_lambda + 0.5));
81 max_err = bl * exp(-0.5 * (k * k)) / k;
82 if (max_err * 2 <= epsilon) {
104 epsilon *= 0.662608824988162441697980;
109 epsilon *= (1 - 1 / (lambda + 1)) * 0.664265347050632847802225;
124 if (k * epsilon >= exp(-0.5 * (k * k))) {
128 right = m_max +
static_cast<int64_t
>(std::ceil(k * std::sqrt(2 * lambda_max) + 0.5));
129 if (right > m_max +
static_cast<int64_t
>(std::ceil((lambda_max + 1) * 0.5))) {
130 STORM_LOG_WARN(
"Fox-Glynn: right = " << right <<
" >> lambda = " << lambda_max <<
", cannot bound the right tail. The results are unreliable.");
136 fgresult.
left =
static_cast<uint64_t
>(left);
137 fgresult.
right =
static_cast<uint64_t
>(right);
140 fgresult.
weights[m - left] = omega / (1.0e+10 * (right - left));
144 ValueType result, log_c_m_inf;
148 tau -= std::log(fgresult.
weights[m - left]);
156 log_c_m_inf = -1.922272 -
log((
double)m) * 0.5;
166 result = log_c_m_inf - i * (i + 1) * (0.5 + (2 * i + 1) / (6 * lambda)) / lambda;
173 double result_1 = log_c_m_inf + i *
log(1 - i / (
double)(m + 1));
176 if (result_1 > result) {
182 int64_t
const log10_result =
static_cast<int64_t
>(std::floor(result * log10_e));
183 STORM_LOG_WARN(
"Fox-Glynn: lambda >= 25, underflow near Poi(" << lambda <<
"," << left <<
") <= " << std::exp(result - log10_result / log10_e)
184 << log10_result <<
". The results are unreliable.");
191 result = log_c_m_inf - i * (i + 1) / (2 * lambda);
193 int64_t
const log10_result =
static_cast<int64_t
>(std::floor(result * log10_e));
194 STORM_LOG_WARN(
"Fox-Glynn: lambda >= 25, underflow near Poi(" << lambda <<
"," << right <<
") <= " << std::exp(result - log10_result / log10_e)
195 << log10_result <<
". The results are unreliable.");