Math trig intrinsics and compiler options

Christian Thalinger Christian.Thalinger at Sun.COM
Mon Jul 27 04:16:10 PDT 2009


[Sorry for the long delay, I was on vacation.]

gustav trede wrote:
> do you mind sharing details about that test so i can reproduce it ?.

Sure, it's a very simple testcase:

public class sin {
    public static void main(String[] args) {
        System.out.println(foo());
    }

    static double foo() {
        double sum = 0.0;
        for (double d = 0.0; d < 2 * Math.PI; d += 0.00000005) {
            sum += bar(d);
        }
//         for (double d = 0.0; d < Math.PI / 4; d += 0.000000001) {
//             sum += bar(d);
//         }
        return sum;
    }

    static double bar(double d) {
        return Math.sin(d);
    }
}

-- Christian



More information about the hotspot-dev mailing list