jdk/test/java/lang/Math/Log1pTests.java
changeset 30048 3424bede284d
parent 30046 cf2c86e1819e
child 30436 17827057ef5a
equal deleted inserted replaced
30047:63b6a16968d5 30048:3424bede284d
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 4851638 4939441
    26  * @library /lib/testlibrary/
    27  * @summary Tests for {Math, StrictMath}.log1p
    27  * @build jdk.testlibrary.*
       
    28  * @run main Log1pTests
       
    29  * @bug 4851638 4939441 8078672
       
    30  * @summary Tests for {Math, StrictMath}.log1p (use -Dseed=X to set PRNG seed)
    28  * @author Joseph D. Darcy
    31  * @author Joseph D. Darcy
    29  * @key randomness
    32  * @key randomness
    30  */
    33  */
    31 
    34 
    32 public class Log1pTests {
    35 public class Log1pTests {
    97             failures += testLog1pCaseWithUlpDiff(d, StrictMath.log(d), 2.001);
   100             failures += testLog1pCaseWithUlpDiff(d, StrictMath.log(d), 2.001);
    98         }
   101         }
    99 
   102 
   100         // Construct random values with exponents ranging from -53 to
   103         // Construct random values with exponents ranging from -53 to
   101         // 52 and compare against HP-15C formula.
   104         // 52 and compare against HP-15C formula.
   102         java.util.Random rand = new java.util.Random();
   105         java.util.Random rand = RandomFactory.getRandom();
   103         for(int i = 0; i < 1000; i++) {
   106         for(int i = 0; i < 1000; i++) {
   104             double d = rand.nextDouble();
   107             double d = rand.nextDouble();
   105 
   108 
   106             d = Math.scalb(d, -53 - Tests.ilogb(d));
   109             d = Math.scalb(d, -53 - Tests.ilogb(d));
   107 
   110