jdk/test/java/lang/Math/IeeeRecommendedTests.java
changeset 10608 7cfca36fc79b
parent 10598 efd29b4b3e67
child 22634 9c18aebe9229
equal deleted inserted replaced
10607:1ba66093449c 10608:7cfca36fc79b
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2011, 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.
   621             {Float.MAX_VALUE,           Float_MAX_VALUEmm},
   621             {Float.MAX_VALUE,           Float_MAX_VALUEmm},
   622             {infinityF,                 Float.MAX_VALUE},
   622             {infinityF,                 Float.MAX_VALUE},
   623         };
   623         };
   624 
   624 
   625         for(int i = 0; i < testCases.length; i++) {
   625         for(int i = 0; i < testCases.length; i++) {
   626             failures+=Tests.test("FpUtils.nextDown(float)",
   626             failures+=Tests.test("Math.nextDown(float)",
   627                                  testCases[i][0], FpUtils.nextDown(testCases[i][0]), testCases[i][1]);
   627                                  testCases[i][0], Math.nextDown(testCases[i][0]), testCases[i][1]);
       
   628 
       
   629             failures+=Tests.test("StrictMath.nextDown(float)",
       
   630                                  testCases[i][0], StrictMath.nextDown(testCases[i][0]), testCases[i][1]);
   628         }
   631         }
   629 
   632 
   630         return failures;
   633         return failures;
   631     }
   634     }
   632 
   635 
   657             {Double.MAX_VALUE,          Double_MAX_VALUEmm},
   660             {Double.MAX_VALUE,          Double_MAX_VALUEmm},
   658             {infinityD,                 Double.MAX_VALUE},
   661             {infinityD,                 Double.MAX_VALUE},
   659         };
   662         };
   660 
   663 
   661         for(int i = 0; i < testCases.length; i++) {
   664         for(int i = 0; i < testCases.length; i++) {
   662             failures+=Tests.test("FpUtils.nextDown(double)",
   665             failures+=Tests.test("Math.nextDown(double)",
   663                                  testCases[i][0], FpUtils.nextDown(testCases[i][0]), testCases[i][1]);
   666                                  testCases[i][0], Math.nextDown(testCases[i][0]), testCases[i][1]);
       
   667 
       
   668             failures+=Tests.test("StrictMath.nextDown(double)",
       
   669                                  testCases[i][0], StrictMath.nextDown(testCases[i][0]), testCases[i][1]);
   664         }
   670         }
   665 
   671 
   666         return failures;
   672         return failures;
   667     }
   673     }
   668 
   674 
   704             // isNaN
   710             // isNaN
   705             failures+=Tests.test("FpUtils.isNaN(float)", testCases[i],
   711             failures+=Tests.test("FpUtils.isNaN(float)", testCases[i],
   706                                  FpUtils.isNaN(testCases[i]), (i ==0));
   712                                  FpUtils.isNaN(testCases[i]), (i ==0));
   707 
   713 
   708             // isFinite
   714             // isFinite
   709             failures+=Tests.test("FpUtils.isFinite(float)", testCases[i],
   715             failures+=Tests.test("Float.isFinite(float)", testCases[i],
   710                                  FpUtils.isFinite(testCases[i]), (i >= 3));
   716                                  Float.isFinite(testCases[i]), (i >= 3));
   711 
   717 
   712             // isInfinite
   718             // isInfinite
   713             failures+=Tests.test("FpUtils.isInfinite(float)", testCases[i],
   719             failures+=Tests.test("FpUtils.isInfinite(float)", testCases[i],
   714                                  FpUtils.isInfinite(testCases[i]), (i==1 || i==2));
   720                                  FpUtils.isInfinite(testCases[i]), (i==1 || i==2));
   715 
   721 
   754             // isNaN
   760             // isNaN
   755             failures+=Tests.test("FpUtils.isNaN(double)", testCases[i],
   761             failures+=Tests.test("FpUtils.isNaN(double)", testCases[i],
   756                                  FpUtils.isNaN(testCases[i]), (i ==0));
   762                                  FpUtils.isNaN(testCases[i]), (i ==0));
   757 
   763 
   758             // isFinite
   764             // isFinite
   759             failures+=Tests.test("FpUtils.isFinite(double)", testCases[i],
   765             failures+=Tests.test("Double.isFinite(double)", testCases[i],
   760                                  FpUtils.isFinite(testCases[i]), (i >= 3));
   766                                  Double.isFinite(testCases[i]), (i >= 3));
   761 
   767 
   762             // isInfinite
   768             // isInfinite
   763             failures+=Tests.test("FpUtils.isInfinite(double)", testCases[i],
   769             failures+=Tests.test("FpUtils.isInfinite(double)", testCases[i],
   764                                  FpUtils.isInfinite(testCases[i]), (i==1 || i==2));
   770                                  FpUtils.isInfinite(testCases[i]), (i==1 || i==2));
   765 
   771