< prev index next >

test/java/lang/Math/HypotTests.java

Print this page




   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 4851638 4939441
  27  * @summary Tests for {Math, StrictMath}.hypot
  28  * @author Joseph D. Darcy

  29  */
  30 
  31 public class HypotTests {
  32     private HypotTests(){}
  33 
  34     static final double infinityD = Double.POSITIVE_INFINITY;
  35     static final double NaNd      = Double.NaN;
  36 
  37     /**
  38      * Given integers m and n, assuming m < n, the triple (n^2 - m^2,
  39      * 2mn, and n^2 + m^2) is a Pythagorean triple with a^2 + b^2 =
  40      * c^2.  This methods returns a long array holding the Pythagorean
  41      * triple corresponding to the inputs.
  42      */
  43     static long [] pythagoreanTriple(int m, int n) {
  44         long M = m;
  45         long N = n;
  46         long result[] = new long[3];
  47 
  48 




   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 4851638 4939441
  27  * @summary Tests for {Math, StrictMath}.hypot
  28  * @author Joseph D. Darcy
  29  * @key randomness
  30  */
  31 
  32 public class HypotTests {
  33     private HypotTests(){}
  34 
  35     static final double infinityD = Double.POSITIVE_INFINITY;
  36     static final double NaNd      = Double.NaN;
  37 
  38     /**
  39      * Given integers m and n, assuming m < n, the triple (n^2 - m^2,
  40      * 2mn, and n^2 + m^2) is a Pythagorean triple with a^2 + b^2 =
  41      * c^2.  This methods returns a long array holding the Pythagorean
  42      * triple corresponding to the inputs.
  43      */
  44     static long [] pythagoreanTriple(int m, int n) {
  45         long M = m;
  46         long N = n;
  47         long result[] = new long[3];
  48 
  49 


< prev index next >