コード例 #1
0
        /**
         * Returns a new {@code BigDecimal} whose value is the integral part of
         * {@code this / divisor}. The quotient is rounded down towards zero to the
         * next integer. The rounding mode passed with the parameter {@code mc} is
         * not considered. But if the precision of {@code mc > 0} and the integral
         * part requires more digits, then an {@code ArithmeticException} is thrown.
         *
         * @param divisor
         *            value by which {@code this} is divided.
         * @param mc
         *            math context which determines the maximal precision of the
         *            result.
         * @return integral part of {@code this / divisor}.
         * @throws NullPointerException
         *             if {@code divisor == null} or {@code mc == null}.
         * @throws ArithmeticException
         *             if {@code divisor == 0}.
         * @throws ArithmeticException
         *             if {@code mc.getPrecision() > 0} and the result requires more
         *             digits to be represented.
         */

        public static BigDecimal DivideToIntegral(BigDecimal a, BigDecimal b, MathContext context)
        {
            return(BigDecimalMath.DivideToIntegralValue(a, b, context));
        }
コード例 #2
0
        /**
         * Returns a new {@code BigDecimal} whose value is the integral part of
         * {@code this / divisor}. The quotient is rounded down towards zero to the
         * next integer. For example, {@code 0.5/0.2 = 2}.
         *
         * @param divisor
         *            value by which {@code this} is divided.
         * @return integral part of {@code this / divisor}.
         * @throws NullPointerException
         *             if {@code divisor == null}.
         * @throws ArithmeticException
         *             if {@code divisor == 0}.
         */

        public static BigDecimal DivideToIntegral(BigDecimal a, BigDecimal b)
        {
            return(BigDecimalMath.DivideToIntegralValue(a, b));
        }