//FIXME: obtain original value :: this is a thread safety problem :(
final boolean oldHighPrecision = settings.isRefineHighPrecisionUsingHalleysMethod();
settings.setRefineHighPrecisionUsingHalleysMethod(false);
InverseCumulativeNormal icn;
//test the normal values
icn = new InverseCumulativeNormal();
for (final double[] normalTestvalue : normal_testvalues) {
final double x_position = normalTestvalue[0];
final double tolerance = 1.0e-15;//(Math.abs(x_position)<3.01) ? 1.0e-15: 1.0e-10;
final double normal_expected = normalTestvalue[1];
final double computed_normal = icn.op(x_position);
if (Math.abs(normal_expected-computed_normal)>tolerance) {
fail("x_position " + x_position + " normal_expected: " + normal_expected + " normal_computed: " + normal_expected);
}
}
//test the normal values using high machine precision Halley's method
settings.setRefineHighPrecisionUsingHalleysMethod(true);
icn = new InverseCumulativeNormal();
for (final double[] precisionTestvalue : precision_testvalues) {
final double x_position = precisionTestvalue[0];
final double tolerance = 1.0e-15;//(Math.abs(x_position)<3.01) ? 1.0e-15: 1.0e-10;
final double precision_expected = precisionTestvalue[1];
final double computed_precision = icn.op(x_position);
if (Math.abs(precision_expected-computed_precision)>tolerance) {
fail("x_position " + x_position + " precision_expected: " + precision_expected + " precision_computed: " + computed_precision);
}
}