// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class TestFP {
    private static final int N = 1000000000;
    public static void main(String[] args) throws Exception {
        long t1 = System.currentTimeMillis();
        double sum = 0;
        for(int i = 0; i < N; i++) {
            sum = ((sum + 1) * 2 + 1) / 2;
        }
        long t2 = System.currentTimeMillis();
        if(Math.abs(sum-1.5*N) > 1) {
            System.out.println("Error");
        } else {
            System.out.println(N + " operations in " + ((t2 - t1) / 1000) + " seconds");
        }
    }
}
