public /*@Real*/ double gaussianExpectedShortfall(/*@Real*/ double percentile) /* @ReadOnly */ {
QL.require(percentile<1.0 && percentile>=0.9, "percentile is out of range [0.9, 1)");
/*@Real*/ double m = this.mean();
/*@Real*/ double std = this.standardDeviation();
final InverseCumulativeNormal gInverse = new InverseCumulativeNormal(m, std);
/*@Real*/ double var = gInverse.op(1.0-percentile);
final NormalDistribution g = new NormalDistribution(m, std);
/*@Real*/ double result = m - std*std*g.op(var)/(1.0-percentile);
// expectedShortfall must be a loss: this means that it has to be MIN(result, 0.0)
// expectedShortfall must also be a positive quantity, so -MIN(*)
return -Math.min(result, 0.0);