test/compiler/7177917/Test7177917.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/test/compiler/7177917/Test7177917.java	Tue Oct 28 19:58:51 2014
--- new/test/compiler/7177917/Test7177917.java	Tue Oct 28 19:58:51 2014

*** 1,7 **** --- 1,7 ---- /* ! * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 24,40 **** --- 24,41 ---- /* * Micro-benchmark for Math.pow() and Math.exp() */ ! import java.util.*; ! import com.oracle.java.testlibrary.Utils; + import java.util.Random; public class Test7177917 { static double d; ! static Random r = new Random(0); ! static final Random R = Utils.getRandomInstance(); static long m_pow(double[][] values) { double res = 0; long start = System.nanoTime(); for (int i = 0; i < values.length; i++) {
*** 57,70 **** --- 58,71 ---- } static double[][] pow_values(int nb) { double[][] res = new double[nb][2]; for (int i = 0; i < nb; i++) { ! double ylogx = (1 + (r.nextDouble() * 2045)) - 1023; // 2045 rather than 2046 as a safety margin ! double x = Math.abs(Double.longBitsToDouble(r.nextLong())); ! double ylogx = (1 + (R.nextDouble() * 2045)) - 1023; // 2045 rather than 2046 as a safety margin ! double x = Math.abs(Double.longBitsToDouble(R.nextLong())); while (x != x) { ! x = Math.abs(Double.longBitsToDouble(r.nextLong())); ! x = Math.abs(Double.longBitsToDouble(R.nextLong())); } double logx = Math.log(x) / Math.log(2); double y = ylogx / logx; res[i][0] = x;
*** 74,84 **** --- 75,85 ---- } static double[] exp_values(int nb) { double[] res = new double[nb]; for (int i = 0; i < nb; i++) { ! double ylogx = (1 + (r.nextDouble() * 2045)) - 1023; // 2045 rather than 2046 as a safety margin ! double ylogx = (1 + (R.nextDouble() * 2045)) - 1023; // 2045 rather than 2046 as a safety margin double x = Math.E; double logx = Math.log(x) / Math.log(2); double y = ylogx / logx; res[i] = y; }

test/compiler/7177917/Test7177917.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File