Test6855215.java revision 11707:ad7af1afda7a
1169695Skan/* 2169695Skan * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved. 3169695Skan * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4169695Skan * 5169695Skan * This code is free software; you can redistribute it and/or modify it 6169695Skan * under the terms of the GNU General Public License version 2 only, as 7169695Skan * published by the Free Software Foundation. 8169695Skan * 9169695Skan * This code is distributed in the hope that it will be useful, but WITHOUT 10169695Skan * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11169695Skan * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12169695Skan * version 2 for more details (a copy is included in the LICENSE file that 13169695Skan * accompanied this code). 14169695Skan * 15169695Skan * You should have received a copy of the GNU General Public License version 16169695Skan * 2 along with this work; if not, write to the Free Software Foundation, 17169695Skan * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18169695Skan * 19169695Skan * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20169695Skan * or visit www.oracle.com if you need additional information or have any 21169695Skan * questions. 22169695Skan * 23169695Skan */ 24169695Skan 25169695Skan/** 26169695Skan * @test 27169695Skan * @bug 6855215 28169695Skan * @summary Calculation error (NaN) after about 1500 calculations 29169695Skan * 30169695Skan * @run main/othervm -Xbatch -XX:UseSSE=0 compiler.c1.Test6855215 31169695Skan */ 32169695Skan 33169695Skanpackage compiler.c1; 34169695Skan 35169695Skanpublic class Test6855215 { 36169695Skan private double m; 37169695Skan private double b; 38169695Skan 39169695Skan public static double log10(double x) { 40169695Skan return Math.log(x) / Math.log(10); 41169695Skan } 42169695Skan 43169695Skan void calcMapping(double xmin, double xmax, double ymin, double ymax) { 44169695Skan m = (ymax - ymin) / (log10(xmax) - log10(xmin)); 45169695Skan b = (log10(xmin) * ymax - log10(xmax) * ymin); 46169695Skan } 47169695Skan 48169695Skan public static void main(String[] args) { 49169695Skan Test6855215 c = new Test6855215(); 50169695Skan for (int i = 0; i < 30000; i++) { 51169695Skan c.calcMapping(91, 121, 177, 34); 52169695Skan if (c.m != c.m) { 53169695Skan throw new InternalError(); 54169695Skan } 55169695Skan } 56169695Skan } 57169695Skan} 58169695Skan