RFR (M): 8132207: Update for x86 exp in the math lib

Christos Zoulas christos at zoulas.com
Fri Jul 24 18:37:26 UTC 2015


On Jul 23,  6:01pm, vivek.r.deshpande at intel.com ("Deshpande, Vivek R") wrote:
-- Subject: RFR (M):  8132207: Update for x86 exp in the math lib

| Hi all
| 
| I would like to contribute a patch which optimizes Math.exp() for 64 and 32=
|  bit X86 architecture using Intel LIBM  implementation.
| Please review and sponsor this patch.
| 
| Bug-id: https://bugs.openjdk.java.net/browse/JDK-8132207
| 
| webrev:
| http://cr.openjdk.java.net/~mcberg/8132207/webrev.01/

I would be very careful with changes like this. Are you sure that
this produces identical results with the current implementation?
In the past we've had problems with the values of transcendental
functions because JIT replaced the java implementations with native
copies and sometimes this were off by 1ULP. This made the following
code fail:

public class LogTest {

    public static void main(String[] args)
    {
        double n = Integer.parseInt("17197");
        double d = Math.log(n);
        System.out.println("n=" + n + ",log(n)=" + d);
        for (int i = 0; i < 100000; i++) {
            double e = Math.log(n);
            if (e != d) {
                System.err.println("ERROR after " + i + " iterations:\n" +
                   "previous value: " + d + " (" +
                   Long.toHexString(Double.doubleToLongBits(d)) + ")\n" +
                   " current value: " + e + " (" +
                   Long.toHexString(Double.doubleToLongBits(e)) + ")");
                System.exit(1);
            }
        }
        System.err.println("SUCCESS!");
        System.exit(0);
    }
}

christos


More information about the hotspot-compiler-dev mailing list