List of utility methods to do BigDecimal Log
BigDecimal | log(int base_int, BigDecimal x) log BigDecimal result = BigDecimal.ZERO; BigDecimal input = new BigDecimal(x.toString()); int decimalPlaces = 100; int scale = input.precision() + decimalPlaces; int maxite = 10000; int ite = 0; BigDecimal maxError_BigDecimal = new BigDecimal(BigInteger.ONE, decimalPlaces + 1); RoundingMode a_RoundingMode = RoundingMode.UP; ... |
BigDecimal | log10(BigDecimal b) log final int NUM_OF_DIGITS = SCALE + 2; MathContext mc = new MathContext(NUM_OF_DIGITS, RoundingMode.HALF_EVEN); if (b.signum() <= 0) { throw new ArithmeticException("log of a negative number! (or zero)"); } else if (b.compareTo(BigDecimal.ONE) == 0) { return BigDecimal.ZERO; } else if (b.compareTo(BigDecimal.ONE) < 0) { return (log10((BigDecimal.ONE).divide(b, mc))).negate(); ... |
int | log10AbsCeil(BigDecimal x) log Abs Ceil int log10 = log10AbsCeil(x.unscaledValue()); return subInts(log10, x.scale()); |
int | log2AbsCeil(BigDecimal x) log Abs Ceil if (x.signum() == 0) { throw new IllegalArgumentException("x == 0"); if (x.signum() < 0) { x = x.negate(); final int compareTo1 = x.compareTo(BigDecimal.ONE); if (compareTo1 == 0) { ... |