test/java/lang/Math/TanTests.java

Print this page




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 5033578
  27  * @summary Tests for {Math, StrictMath}.tan



  28  * @author Joseph D. Darcy
  29  */
  30 
  31 public class TanTests {
  32     private TanTests(){}
  33 
  34     static int testTanCase(double input, double expected, double ulps) {
  35         int failures = 0;
  36         failures += Tests.testUlpDiff("StrictMath.tan(double, double)", input,
  37                                StrictMath.tan(input), expected, ulps);
  38         failures += Tests.testUlpDiff("Math.tan(double, double)", input,
  39                                Math.tan(input), expected, ulps);
  40         return failures;
  41     }
  42 
  43     static int testTan() {
  44         int failures = 0;
  45 
  46         double [][] testCases = {
  47             // 1.1 ulp case from Gonnet




   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @bug 5033578
  27  * @summary Tests for {Math, StrictMath}.tan
  28  * @library /lib/testlibrary
  29  * @build jdk.testlibrary.DoubleUtils jdk.testlibrary.FloatUtils
  30  * @run main TanTests
  31  * @author Joseph D. Darcy
  32  */
  33 
  34 public class TanTests {
  35     private TanTests(){}
  36 
  37     static int testTanCase(double input, double expected, double ulps) {
  38         int failures = 0;
  39         failures += Tests.testUlpDiff("StrictMath.tan(double, double)", input,
  40                                StrictMath.tan(input), expected, ulps);
  41         failures += Tests.testUlpDiff("Math.tan(double, double)", input,
  42                                Math.tan(input), expected, ulps);
  43         return failures;
  44     }
  45 
  46     static int testTan() {
  47         int failures = 0;
  48 
  49         double [][] testCases = {
  50             // 1.1 ulp case from Gonnet