1 /*
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
626 * the result is NaN.
627 * </ul>
628 *
629 * <li>If both arguments are integers, then the result is exactly equal
630 * to the mathematical result of raising the first argument to the power
631 * of the second argument if that result can in fact be represented
632 * exactly as a {@code double} value.</ul>
633 *
634 * <p>(In the foregoing descriptions, a floating-point value is
635 * considered to be an integer if and only if it is finite and a
636 * fixed point of the method {@link #ceil ceil} or,
637 * equivalently, a fixed point of the method {@link #floor
638 * floor}. A value is a fixed point of a one-argument
639 * method if and only if the result of applying the method to the
640 * value is equal to the value.)
641 *
642 * @param a base.
643 * @param b the exponent.
644 * @return the value {@code a}<sup>{@code b}</sup>.
645 */
646 public static native double pow(double a, double b);
647
648 /**
649 * Returns the closest {@code int} to the argument, with ties
650 * rounding to positive infinity.
651 *
652 * <p>Special cases:
653 * <ul><li>If the argument is NaN, the result is 0.
654 * <li>If the argument is negative infinity or any value less than or
655 * equal to the value of {@code Integer.MIN_VALUE}, the result is
656 * equal to the value of {@code Integer.MIN_VALUE}.
657 * <li>If the argument is positive infinity or any value greater than or
658 * equal to the value of {@code Integer.MAX_VALUE}, the result is
659 * equal to the value of {@code Integer.MAX_VALUE}.</ul>
660 *
661 * @param a a floating-point value to be rounded to an integer.
662 * @return the value of the argument rounded to the nearest
663 * {@code int} value.
664 * @see java.lang.Integer#MAX_VALUE
665 * @see java.lang.Integer#MIN_VALUE
666 */
|
1 /*
2 * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
626 * the result is NaN.
627 * </ul>
628 *
629 * <li>If both arguments are integers, then the result is exactly equal
630 * to the mathematical result of raising the first argument to the power
631 * of the second argument if that result can in fact be represented
632 * exactly as a {@code double} value.</ul>
633 *
634 * <p>(In the foregoing descriptions, a floating-point value is
635 * considered to be an integer if and only if it is finite and a
636 * fixed point of the method {@link #ceil ceil} or,
637 * equivalently, a fixed point of the method {@link #floor
638 * floor}. A value is a fixed point of a one-argument
639 * method if and only if the result of applying the method to the
640 * value is equal to the value.)
641 *
642 * @param a base.
643 * @param b the exponent.
644 * @return the value {@code a}<sup>{@code b}</sup>.
645 */
646 public static double pow(double a, double b) {
647 return FdLibm.Pow.compute(a, b);
648 }
649
650 /**
651 * Returns the closest {@code int} to the argument, with ties
652 * rounding to positive infinity.
653 *
654 * <p>Special cases:
655 * <ul><li>If the argument is NaN, the result is 0.
656 * <li>If the argument is negative infinity or any value less than or
657 * equal to the value of {@code Integer.MIN_VALUE}, the result is
658 * equal to the value of {@code Integer.MIN_VALUE}.
659 * <li>If the argument is positive infinity or any value greater than or
660 * equal to the value of {@code Integer.MAX_VALUE}, the result is
661 * equal to the value of {@code Integer.MAX_VALUE}.</ul>
662 *
663 * @param a a floating-point value to be rounded to an integer.
664 * @return the value of the argument rounded to the nearest
665 * {@code int} value.
666 * @see java.lang.Integer#MAX_VALUE
667 * @see java.lang.Integer#MIN_VALUE
668 */
|