616 * to the mathematical result of raising the first argument to the power
617 * of the second argument if that result can in fact be represented
618 * exactly as a {@code double} value.</ul>
619 *
620 * <p>(In the foregoing descriptions, a floating-point value is
621 * considered to be an integer if and only if it is finite and a
622 * fixed point of the method {@link #ceil ceil} or,
623 * equivalently, a fixed point of the method {@link #floor
624 * floor}. A value is a fixed point of a one-argument
625 * method if and only if the result of applying the method to the
626 * value is equal to the value.)
627 *
628 * @param a base.
629 * @param b the exponent.
630 * @return the value {@code a}<sup>{@code b}</sup>.
631 */
632 public static native double pow(double a, double b);
633
634 /**
635 * Returns the closest {@code int} to the argument, with ties
636 * rounding up.
637 *
638 * <p>Special cases:
639 * <ul><li>If the argument is NaN, the result is 0.
640 * <li>If the argument is negative infinity or any value less than or
641 * equal to the value of {@code Integer.MIN_VALUE}, the result is
642 * equal to the value of {@code Integer.MIN_VALUE}.
643 * <li>If the argument is positive infinity or any value greater than or
644 * equal to the value of {@code Integer.MAX_VALUE}, the result is
645 * equal to the value of {@code Integer.MAX_VALUE}.</ul>
646 *
647 * @param a a floating-point value to be rounded to an integer.
648 * @return the value of the argument rounded to the nearest
649 * {@code int} value.
650 * @see java.lang.Integer#MAX_VALUE
651 * @see java.lang.Integer#MIN_VALUE
652 */
653 public static int round(float a) {
654 return Math.round(a);
655 }
656
657 /**
658 * Returns the closest {@code long} to the argument, with ties
659 * rounding up.
660 *
661 * <p>Special cases:
662 * <ul><li>If the argument is NaN, the result is 0.
663 * <li>If the argument is negative infinity or any value less than or
664 * equal to the value of {@code Long.MIN_VALUE}, the result is
665 * equal to the value of {@code Long.MIN_VALUE}.
666 * <li>If the argument is positive infinity or any value greater than or
667 * equal to the value of {@code Long.MAX_VALUE}, the result is
668 * equal to the value of {@code Long.MAX_VALUE}.</ul>
669 *
670 * @param a a floating-point value to be rounded to a
671 * {@code long}.
672 * @return the value of the argument rounded to the nearest
673 * {@code long} value.
674 * @see java.lang.Long#MAX_VALUE
675 * @see java.lang.Long#MIN_VALUE
676 */
677 public static long round(double a) {
678 return Math.round(a);
679 }
|
616 * to the mathematical result of raising the first argument to the power
617 * of the second argument if that result can in fact be represented
618 * exactly as a {@code double} value.</ul>
619 *
620 * <p>(In the foregoing descriptions, a floating-point value is
621 * considered to be an integer if and only if it is finite and a
622 * fixed point of the method {@link #ceil ceil} or,
623 * equivalently, a fixed point of the method {@link #floor
624 * floor}. A value is a fixed point of a one-argument
625 * method if and only if the result of applying the method to the
626 * value is equal to the value.)
627 *
628 * @param a base.
629 * @param b the exponent.
630 * @return the value {@code a}<sup>{@code b}</sup>.
631 */
632 public static native double pow(double a, double b);
633
634 /**
635 * Returns the closest {@code int} to the argument, with ties
636 * rounding to positive infinity.
637 *
638 * <p>Special cases:
639 * <ul><li>If the argument is NaN, the result is 0.
640 * <li>If the argument is negative infinity or any value less than or
641 * equal to the value of {@code Integer.MIN_VALUE}, the result is
642 * equal to the value of {@code Integer.MIN_VALUE}.
643 * <li>If the argument is positive infinity or any value greater than or
644 * equal to the value of {@code Integer.MAX_VALUE}, the result is
645 * equal to the value of {@code Integer.MAX_VALUE}.</ul>
646 *
647 * @param a a floating-point value to be rounded to an integer.
648 * @return the value of the argument rounded to the nearest
649 * {@code int} value.
650 * @see java.lang.Integer#MAX_VALUE
651 * @see java.lang.Integer#MIN_VALUE
652 */
653 public static int round(float a) {
654 return Math.round(a);
655 }
656
657 /**
658 * Returns the closest {@code long} to the argument, with ties
659 * rounding to positive infinity.
660 *
661 * <p>Special cases:
662 * <ul><li>If the argument is NaN, the result is 0.
663 * <li>If the argument is negative infinity or any value less than or
664 * equal to the value of {@code Long.MIN_VALUE}, the result is
665 * equal to the value of {@code Long.MIN_VALUE}.
666 * <li>If the argument is positive infinity or any value greater than or
667 * equal to the value of {@code Long.MAX_VALUE}, the result is
668 * equal to the value of {@code Long.MAX_VALUE}.</ul>
669 *
670 * @param a a floating-point value to be rounded to a
671 * {@code long}.
672 * @return the value of the argument rounded to the nearest
673 * {@code long} value.
674 * @see java.lang.Long#MAX_VALUE
675 * @see java.lang.Long#MIN_VALUE
676 */
677 public static long round(double a) {
678 return Math.round(a);
679 }
|