/src/main/java/net/finmath/functions/NonCentralChiSquaredDistribution.java
gammaRegularized / += Math.exp( ( degreesOfFreedomHalf + i) * xHalfLog - xHalf - Gamma.logGamma( degreesOfFreedomHalf + i + 1) ) ;
gammaRegularized += Math.exp ( ( degreesOfFreedomHalf + i ) * xHalfLog - xHalf - Gamma.logGamma ( degreesOfFreedomHalf + i + 1 ) ) ;
double gammaRegularized = gammaRegularizedInitial; double sum = p * gammaRegularized; double error = 0.0; double newSum = 0.0; for(int i=summationSplitIndex-1; i >= 0; i--) { p *= (i + 1) / nonCentralityHalf; <extra_id_0> final double value = p * gammaRegularized - error; newSum = sum + value; error = (newSum - sum) - value; if(Math.abs(newSum - sum) / newSum <= PRECISION) { break; }