hotspot/test/compiler/c1/6855215/Test6855215.java
author ykantser
Thu, 07 May 2015 09:11:49 +0200
changeset 30376 2ccf2cf7ea48
parent 27699 9913b19c0948
permissions -rw-r--r--
8078896: Add @modules as needed to the jdk_svc tests Reviewed-by: alanb, mchung
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3800
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3800
diff changeset
     2
 * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
3800
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
     4
 *
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
     7
 * published by the Free Software Foundation.
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
     8
 *
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    13
 * accompanied this code).
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    14
 *
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3800
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3800
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3800
diff changeset
    21
 * questions.
3800
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    22
 *
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    23
 */
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    24
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    25
/**
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    26
 * @test
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    27
 * @bug 6855215
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    28
 * @summary Calculation error (NaN) after about 1500 calculations
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    29
 *
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    30
 * @run main/othervm -Xbatch -XX:UseSSE=0 Test6855215
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    31
 */
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    32
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    33
public class Test6855215 {
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    34
    private double m;
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    35
    private double b;
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    36
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    37
    public static double log10(double x) {
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    38
        return Math.log(x) / Math.log(10);
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    39
    }
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    40
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    41
    void calcMapping(double xmin, double xmax, double ymin, double ymax) {
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    42
        m = (ymax - ymin) / (log10(xmax) - log10(xmin));
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    43
        b = (log10(xmin) * ymax - log10(xmax) * ymin);
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    44
    }
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    45
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    46
    public static void main(String[] args) {
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    47
        Test6855215 c = new Test6855215();
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    48
        for (int i = 0; i < 30000; i++) {
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    49
            c.calcMapping(91, 121, 177, 34);
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    50
            if (c.m != c.m) {
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    51
                throw new InternalError();
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    52
            }
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    53
        }
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    54
    }
3195b4844b5a 6855215: Calculation error (NaN) after about 1500 calculations
never
parents:
diff changeset
    55
}