Code example for BigDecimal

Methods: divide

0
        } 
    } 
 
    static class ceilingBI extends NumberBuiltIn { 
        TemplateModel calculateResult(Number num, TemplateModel model) {
            return new SimpleNumber(new BigDecimal(num.doubleValue()).divide(BIG_DECIMAL_ONE, 0, BigDecimal.ROUND_CEILING));
        } 
    } 
 
    static class roundBI extends NumberBuiltIn { 
        private static final BigDecimal half = new BigDecimal("0.5");
        TemplateModel calculateResult(Number num, TemplateModel model) {
            return new SimpleNumber(new BigDecimal(num.doubleValue()).add(half).divide(BIG_DECIMAL_ONE, 0, BigDecimal.ROUND_FLOOR));
        } 
    } 
 
    static class absBI extends NumberBuiltIn { 
        TemplateModel calculateResult(Number num, TemplateModel model) throws TemplateModelException {
            if (num instanceof Integer) {
                int n = ((Integer) num).intValue();
                if (n < 0) {