public static double Function(double h, double a)
{
double absa;
double absh;
double ah;
const double cut = 0.67;
double normah;
double normh;
double value;
absh = Math.Abs(h);
absa = Math.Abs(a);
ah = absa * absh;
if (absa <= 1.0)
{
value = Function(absh, absa, ah);
}
else if (absh <= cut)
{
value = 0.25 - (-0.5 + Normal.Function(absh)) * (-0.5 + Normal.Function(ah))
- Function(ah, 1.0 / absa, absh);
}
else
{
normh = Normal.Complemented(absh);
normah = Normal.Complemented(ah);
value = 0.5 * (normh + normah) - normh * normah
- Function(ah, 1.0 / absa, absh);
}
if (a < 0.0)
value = -value;
return value;
}