System.out.println("Testing DErule");
a=0.0;
b=1.0;
func_DErule func_DErule = new func_DErule();
DErule derule = new DErule(func_DErule,a,b);
expect=2.0-PI*PI/6.0;
sold=derule.next();
sbeps=1.e-15;
for (i=0;i<M;i++) {
s=derule.next();
if (abs(s-sold) < sbeps) break;
else sold=s;
}
System.out.printf("DErule,case 1: Maximum discrepancy = %f\n", abs(s-expect));
localflag = abs(s-expect) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** DErule,case 2: Failure to achieve expected accuracy in improper integral");
}
a=0.0;
b=1.0;
func_DErule2 func_DErule2 = new func_DErule2();
DErule derule2 = new DErule(func_DErule2,a,b,4.5);
expect=PI;
sold=derule2.next();
sbeps=1.e-15;
for (i=0;i<M;i++) {
s=derule2.next();
if (abs(s-sold) < sbeps) break;
else sold=s;
}
System.out.printf("DErule,case 2: Maximum discrepancy = %f\n", abs(s-expect));