/** A program to test arithmetic * * @author Duncan Buell * * Program written: 14 October 2007 */ public class Main2 { public static void main (String[] args) { double theValue,theOldValue; ComputeIntegral theIntegral = new ComputeIntegral(); System.out.printf("%n"); System.out.printf("segments area double%n"); theOldValue = 0.0; for(int i = 10; i <= 100000; i = i+10) { theValue = theIntegral.doIntegral(-1.0, +1.0, i); System.out.printf("%7d %24.20f %24.20f %24.20f%n", i,theValue,2.0*theValue,2.0*(theValue - theOldValue)); if(theOldValue > theValue) { System.out.printf("Numerical error%n"); System.exit(0); } theOldValue = theValue; } // for(int i = 10; i < 100; i = i+100) } } // public class Main2