953N/A/*
1472N/A * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
953N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
953N/A *
953N/A * This code is free software; you can redistribute it and/or modify it
953N/A * under the terms of the GNU General Public License version 2 only, as
953N/A * published by the Free Software Foundation.
953N/A *
953N/A * This code is distributed in the hope that it will be useful, but WITHOUT
953N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
953N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
953N/A * version 2 for more details (a copy is included in the LICENSE file that
953N/A * accompanied this code).
953N/A *
953N/A * You should have received a copy of the GNU General Public License version
953N/A * 2 along with this work; if not, write to the Free Software Foundation,
953N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
953N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
953N/A *
953N/A */
953N/A
953N/A/**
953N/A * @test
953N/A * @bug 6855215
953N/A * @summary Calculation error (NaN) after about 1500 calculations
953N/A *
953N/A * @run main/othervm -Xbatch -XX:UseSSE=0 Test6855215
953N/A */
953N/A
953N/Apublic class Test6855215 {
953N/A private double m;
953N/A private double b;
953N/A
953N/A public static double log10(double x) {
953N/A return Math.log(x) / Math.log(10);
953N/A }
953N/A
953N/A void calcMapping(double xmin, double xmax, double ymin, double ymax) {
953N/A m = (ymax - ymin) / (log10(xmax) - log10(xmin));
953N/A b = (log10(xmin) * ymax - log10(xmax) * ymin);
953N/A }
953N/A
953N/A public static void main(String[] args) {
953N/A Test6855215 c = new Test6855215();
953N/A for (int i = 0; i < 30000; i++) {
953N/A c.calcMapping(91, 121, 177, 34);
953N/A if (c.m != c.m) {
953N/A throw new InternalError();
953N/A }
953N/A }
953N/A }
953N/A}