List of utility methods to do Double Number Divide
String | divide(String thisVal, String addVal) divide String result = null; BigDecimal one = new BigDecimal(thisVal == null ? "0" : thisVal); BigDecimal two = new BigDecimal(addVal == null ? "0" : addVal); result = one.divide(two).toString(); return result; |
double | divide4Money(Double value1, Double value2) divide Money return getScaleValue4Money(defaultValue(value1).doubleValue() / defaultValue(value2).doubleValue());
|
double[] | divideComplex(double realOne, double imagOne, double realTwo, double imagTwo) Divides two complex values double[] revan = new double[2]; double denominator = Math.pow(realTwo, 2) + Math.pow(imagTwo, 2); revan[0] = ((realOne * realTwo) + (imagOne * imagTwo)) / denominator; revan[1] = ((imagOne * realTwo) - (realOne * imagTwo)) / denominator; return revan; |
double | divideDouble(double first, double second) divide Double BigDecimal b1 = new BigDecimal(first); BigDecimal b2 = new BigDecimal(second); return b1.divide(b2).doubleValue(); |
double | divideDouble(double first, double second, int scale, int roundingMode) divide Double BigDecimal b1 = new BigDecimal(first); BigDecimal b2 = new BigDecimal(second); if (roundingMode == -1) { roundingMode = BigDecimal.ROUND_HALF_EVEN; return b1.divide(b2, scale, BigDecimal.ROUND_HALF_EVEN).doubleValue(); |
double | divideInts(int numerator, int denominator) Provides exact division of two integer values by using BigDecimal division. BigDecimal result = BigDecimal.valueOf(numerator).divide(BigDecimal.valueOf(denominator), DECIMAL_SCALE,
BigDecimal.ROUND_HALF_UP);
return result.doubleValue();
|
String | divideNumber(Object divisor, Object dividend) divide Number if (divisor == null || dividend == null) { return ""; BigDecimal a = toBig(divisor); BigDecimal b = toBig(dividend); if (a.equals(toBig(0)) || b.equals(toBig(0))) { return "0"; BigDecimal c = a.divide(b, 2, BigDecimal.ROUND_DOWN); return c.toString(); |
double | divZ(double z) Returns the reciprocal of a number, or zero if undefined. return z == 0 ? 1 : 1 / z;
|
int | getIntDividedCeil(final int nDividend, final int nDivisor) get Int Divided Ceil return getIntDivided(nDividend, nDivisor, RoundingMode.CEILING);
|
long | getLongDivided(final long nDividend, final long nDivisor, @Nonnull final RoundingMode eRoundingMode) get Long Divided return new BigDecimal(nDividend).divide(new BigDecimal(nDivisor), eRoundingMode).longValue(); |