Enum RoundingMode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<RoundingMode>

    public enum RoundingMode
    extends java.lang.Enum<RoundingMode>
    • Enum Constant Detail

      • ROUND_NEAREST_TIES_TO_EVEN

        public static final RoundingMode ROUND_NEAREST_TIES_TO_EVEN
        Round to the nearest even number. If the two nearest floating-point numbers bracketing an unrepresentable infinitely precise result are equally near, the one with an even least significant digit will be delivered.
      • ROUND_TOWARD_POSITIVE

        public static final RoundingMode ROUND_TOWARD_POSITIVE
        Round towards positive infinity (SMT-LIB: +oo). The result shall be the format's floating-point number (possibly +oo) closest to and no less than the infinitely precise result.
      • ROUND_TOWARD_NEGATIVE

        public static final RoundingMode ROUND_TOWARD_NEGATIVE
        Round towards negative infinity (-oo). The result shall be the format's floating-point number (possibly -oo) closest to and no less than the infinitely precise result.
      • ROUND_TOWARD_ZERO

        public static final RoundingMode ROUND_TOWARD_ZERO
        Round towards zero. The result shall be the format's floating-point number closest to and no greater in magnitude than the infinitely precise result.
      • ROUND_NEAREST_TIES_TO_AWAY

        public static final RoundingMode ROUND_NEAREST_TIES_TO_AWAY
        Round to the nearest number away from zero. If the two nearest floating-point numbers bracketing an unrepresentable infinitely precise result are equally near, the one with larger magnitude will be selected.
    • Method Detail

      • values

        public static RoundingMode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (RoundingMode c : RoundingMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static RoundingMode valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getValue

        public int getValue()