private static BigDecimal dividePrimitiveLongs(long scaledDividend, long scaledDivisor, int scale, RoundingMode roundingMode) { long quotient = scaledDividend / scaledDivisor; long remainder = scaledDividend % scaledDivisor; int sign = Long.signum( scaledDividend ) * Long.signum( scaledDivisor ); if (remainder != 0) { // Checking if: remainder * 2 >= scaledDivisor int compRem; // 'compare to remainder' compRem = longCompareTo(Math.abs(remainder) * 2,Math.abs(scaledDivisor)); // To look if there is a carry quotient += roundingBehavior(((int)quotient) & 1, sign * (5 + compRem), roundingMode); } // Constructing the result with the appropriate unscaled value return valueOf(quotient, scale); }
compRem = longCompareTo(Math.abs(rem) * 2,Math.abs(divisor)); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode);
integer += roundingBehavior( ((int)integer) & 1, Long.signum(fraction) * (5 + compRem), mc.getRoundingMode());
compRem = roundingBehavior( integerAndFraction[0].testBit(0) ? 1 : 0, integerAndFraction[1].signum() * (5 + compRem), mc.getRoundingMode());
private static BigDecimal dividePrimitiveLongs(long scaledDividend, long scaledDivisor, int scale, RoundingMode roundingMode) { long quotient = scaledDividend / scaledDivisor; long remainder = scaledDividend % scaledDivisor; int sign = Long.signum( scaledDividend ) * Long.signum( scaledDivisor ); if (remainder != 0) { // Checking if: remainder * 2 >= scaledDivisor int compRem; // 'compare to remainder' compRem = longCompareTo(Math.abs(remainder) * 2,Math.abs(scaledDivisor)); // To look if there is a carry quotient += roundingBehavior(((int)quotient) & 1, sign * (5 + compRem), roundingMode); } // Constructing the result with the appropriate unscaled value return valueOf(quotient, scale); }
private static BigDecimal dividePrimitiveLongs(long scaledDividend, long scaledDivisor, int scale, RoundingMode roundingMode) { long quotient = scaledDividend / scaledDivisor; long remainder = scaledDividend % scaledDivisor; int sign = Long.signum( scaledDividend ) * Long.signum( scaledDivisor ); if (remainder != 0) { // Checking if: remainder * 2 >= scaledDivisor int compRem; // 'compare to remainder' compRem = longCompareTo(Math.abs(remainder) * 2,Math.abs(scaledDivisor)); // To look if there is a carry quotient += roundingBehavior(((int)quotient) & 1, sign * (5 + compRem), roundingMode); } // Constructing the result with the appropriate unscaled value return valueOf(quotient, scale); }
private static BigDecimal dividePrimitiveLongs(long scaledDividend, long scaledDivisor, int scale, RoundingMode roundingMode) { long quotient = scaledDividend / scaledDivisor; long remainder = scaledDividend % scaledDivisor; int sign = Long.signum( scaledDividend ) * Long.signum( scaledDivisor ); if (remainder != 0) { // Checking if: remainder * 2 >= scaledDivisor int compRem; // 'compare to remainder' compRem = longCompareTo(Math.abs(remainder) * 2,Math.abs(scaledDivisor)); // To look if there is a carry quotient += roundingBehavior(((int)quotient) & 1, sign * (5 + compRem), roundingMode); } // Constructing the result with the appropriate unscaled value return valueOf(quotient, scale); }
private static BigDecimal dividePrimitiveLongs(long scaledDividend, long scaledDivisor, int scale, RoundingMode roundingMode) { long quotient = scaledDividend / scaledDivisor; long remainder = scaledDividend % scaledDivisor; int sign = Long.signum( scaledDividend ) * Long.signum( scaledDivisor ); if (remainder != 0) { // Checking if: remainder * 2 >= scaledDivisor int compRem; // 'compare to remainder' compRem = longCompareTo(Math.abs(remainder) * 2,Math.abs(scaledDivisor)); // To look if there is a carry quotient += roundingBehavior(((int)quotient) & 1, sign * (5 + compRem), roundingMode); } // Constructing the result with the appropriate unscaled value return valueOf(quotient, scale); }
private static BigDecimal dividePrimitiveLongs(long scaledDividend, long scaledDivisor, int scale, RoundingMode roundingMode) { long quotient = scaledDividend / scaledDivisor; long remainder = scaledDividend % scaledDivisor; int sign = Long.signum( scaledDividend ) * Long.signum( scaledDivisor ); if (remainder != 0) { // Checking if: remainder * 2 >= scaledDivisor int compRem; // 'compare to remainder' compRem = longCompareTo(Math.abs(remainder) * 2,Math.abs(scaledDivisor)); // To look if there is a carry quotient += roundingBehavior(((int)quotient) & 1, sign * (5 + compRem), roundingMode); } // Constructing the result with the appropriate unscaled value return valueOf(quotient, scale); }
private static BigDecimal dividePrimitiveLongs(long scaledDividend, long scaledDivisor, int scale, RoundingMode roundingMode) { long quotient = scaledDividend / scaledDivisor; long remainder = scaledDividend % scaledDivisor; int sign = Long.signum( scaledDividend ) * Long.signum( scaledDivisor ); if (remainder != 0) { // Checking if: remainder * 2 >= scaledDivisor int compRem; // 'compare to remainder' compRem = longCompareTo(Math.abs(remainder) * 2,Math.abs(scaledDivisor)); // To look if there is a carry quotient += roundingBehavior(((int)quotient) & 1, sign * (5 + compRem), roundingMode); } // Constructing the result with the appropriate unscaled value return valueOf(quotient, scale); }
compRem = longCompareTo(Math.abs(rem) * 2,Math.abs(divisor)); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode);
compRem = longCompareTo(Math.abs(rem) * 2,Math.abs(divisor)); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode);
compRem = longCompareTo(Math.abs(rem) * 2,Math.abs(divisor)); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode);
compRem = longCompareTo(Math.abs(rem) * 2,Math.abs(divisor)); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode);
compRem = longCompareTo(Math.abs(rem) * 2,Math.abs(divisor)); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode);
compRem = longCompareTo(Math.abs(rem) * 2,Math.abs(divisor)); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode); compRem = roundingBehavior(quotient.testBit(0) ? 1 : 0, sign * (5 + compRem), roundingMode);
integer += roundingBehavior( ((int)integer) & 1, Long.signum(fraction) * (5 + compRem), mc.getRoundingMode());
integer += roundingBehavior( ((int)integer) & 1, Long.signum(fraction) * (5 + compRem), mc.getRoundingMode());
integer += roundingBehavior( ((int)integer) & 1, Long.signum(fraction) * (5 + compRem), mc.getRoundingMode());
integer += roundingBehavior( ((int)integer) & 1, Long.signum(fraction) * (5 + compRem), mc.getRoundingMode());