26#include <boost/math/distributions/normal.hpp>
40 Real sum=1.0, zsqr=z*z, i=1.0, g=1.0, x,
y,
45 y = x*((4.0*i-1)/zsqr);
51 }
while (lasta>a && a>=std::fabs(sum*
QL_EPSILON));
57 #if !defined(QL_PATCH_SOLARIS)
92 if (x <= 0.0 || x >= 1.0) {
99 QL_FAIL(
"InverseCumulativeNormal(" << x
100 <<
") undefined: must be 0 < x < 1");
107 z = std::sqrt(-2.0*std::log(x));
112 z = std::sqrt(-2.0*std::log(1.0-x));
142 "MoroInverseCumulativeNormal(" << x
143 <<
") undefined: must be 0<x<1");
148 if (std::fabs(temp) < 0.42) {
153 ((((
b3_*result+
b2_)*result+
b1_)*result+
b0_)*result+1.0);
160 result = std::log(-std::log(result));
161 result =
c0_+result*(
c1_+result*(
c2_+result*(
c3_+result*
176 return boost::math::quantile(
185 return boost::math::cdf(
Cumulative normal distribution function.
Real operator()(Real x) const
ErrorFunction errorFunction_
NormalDistribution gaussian_
static Real tail_value(Real x)
static const CumulativeNormalDistribution f_
static const Real x_high_
Real operator()(Real x) const
MaddockCumulativeNormal(Real average=0.0, Real sigma=1.0)
MaddockInverseCumulativeNormal(Real average=0.0, Real sigma=1.0)
Real operator()(Real x) const
Real operator()(Real x) const
floating-point comparisons
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
bool close_enough(const Quantity &m1, const Quantity &m2, Size n)
normal, cumulative and inverse cumulative distributions