<p>
It converts the input into a {@link BigDecimal} using the given scale and {@link RoundingMode}
</p>

@param scale the scale to be used
@param roundingMode the {@link RoundingMode} to round the input with
@return the {@link BigDecimal}
972056
public static final Function<Number,BigDecimal> toBigDecimal(final int scale, final RoundingMode roundingMode) {
        return new ToBigDecimal(scale, roundingMode);
    }
1311231
public static BigDecimal div(Number v1, Number v2, int scale) {
		return div(v1, v2, scale, RoundingMode.HALF_UP);
	}
508434
public static BigDecimal inverse(final BigDecimal value, final int scale) {
        return inverse(value, scale, BigDecimal.ROUND_HALF_UP);
    }
581891
public BigDecimal BigDecimalValue(MathContext mc) {
        /* numerator and denominator individually rephrased
         */
        BigDecimal n = new BigDecimal(a);
        BigDecimal d = new BigDecimal(b);
        return n.divide(d, mc);
    }
804191
public static BigDecimal decimalRound(BigDecimal number, int numDigits, RoundingMode rounding) {
        BigDecimal rounded = number.setScale(numDigits, rounding);

        if (numDigits < 0) {
            rounded = rounded.setScale(0, BigDecimal.ROUND_UNNECESSARY);
        }

        return rounded;
    }
542211
public final BigDecimal getDecimal(final int pos, final int precision, final int scale) {
        final int intg = precision - scale;
        final int frac = scale;
        final int intg0 = intg / DIG_PER_INT32;
        final int frac0 = frac / DIG_PER_INT32;
        final int intg0x = intg - intg0 * DIG_PER_INT32;
        final int frac0x = frac - frac0 * DIG_PER_INT32;

        final int binSize = intg0 * SIZE_OF_INT32 + dig2bytes[intg0x] + frac0 * SIZE_OF_INT32 + dig2bytes[frac0x];
        if (pos + binSize > limit || pos < 0) {
            throw new IllegalArgumentException("limit excceed: " + (pos < 0 ? pos : (pos + binSize)));
        }
        return getDecimal0(origin + pos, intg, frac, // NL
            intg0,
            frac0,
            intg0x,
            frac0x);
    }
982999
@Override
    @Deprecated
    public BigDecimal getBigDecimal(int parameterIndex, int scale) throws SQLException
    {
        checkClosed();
        throw SQLError.noSupport();
    }
642889
public static BigDecimal decimalPow(BigDecimal number, BigDecimal power) {
        return new BigDecimal(Math.pow(number.doubleValue(), power.doubleValue()), MATH);
    }
448791
static BigDecimal decimal(String value) {
        BigDecimal result;
        if (value != null) {
            value = value.trim();
            Matcher matcher = DECIMAL_PATTERN.matcher(value);
            if (matcher.matches()) {
                result = new BigDecimal(matcher.group(1));
            } else {
                throw new IllegalArgumentException("Unknown format for value: " + value);
            }
        } else {
            result = null;
        }
        return result;
    }
426200
public static BigDecimal sround(BigDecimal b0, int b1) {
		return b0.movePointRight(b1)
			.setScale(0, RoundingMode.HALF_UP).movePointLeft(b1);
	}
42107
public static double divide(long numerator, long denominator, int scale) {
        BigDecimal numeratorBd = new BigDecimal(numerator);
        BigDecimal denominatorBd = new BigDecimal(denominator);
        return numeratorBd.divide(denominatorBd, scale, BigDecimal.ROUND_HALF_UP).doubleValue();
    }
36447
public static BigDecimal round(BigDecimal number, int scale, RoundingMode roundingMode) {
		if (null == number) {
			number = BigDecimal.ZERO;
		}
		if (scale < 0) {
			scale = 0;
		}
		if (null == roundingMode) {
			roundingMode = RoundingMode.HALF_UP;
		}

		return number.setScale(scale, roundingMode);
	}
886550
public BigDecimal compute(int scale, RoundingMode mode) {
    return numerator.divide(denominator, scale, mode).stripTrailingZeros();
  }
1285941
private BigDecimal round(BigDecimal amount) {
        return new BigDecimal(amount.movePointRight(2).add(new BigDecimal(".5")).toBigInteger()).movePointLeft(2);
    }
830083
public static BigDecimal round(BigDecimal number, int scale) {
		return round(number, scale, RoundingMode.HALF_UP);
	}
425368
public BigDecimal toBigDecimal() {
		int precision = Math.max(precision(), MathContext.DECIMAL128.getPrecision());
		return toBigDecimal(new MathContext(precision));
	}
603360
@Override
    public NumberValue round(MathContext mathContext) {
        if (this.number instanceof BigDecimal) {
            return new DefaultNumberValue(((BigDecimal) this.number).round(mathContext));
        }
        return new DefaultNumberValue(new BigDecimal(this.number.toString()).round(mathContext));
    }