public static Value truncRound(final ValueList valueList, final boolean trunc) {
        valueList.assertCheckCount(1, 2, false);
        valueList.assertCheckTypes((v, i) -> {
            if (i == 0) {
                return v.isNumeric();
            }
            return v.isLongBetween(0, 20);
        }, i -> "Numeric, Int between 0-20", false);

        return Value.of(valueList.getAsDecimal(0).setScale((int) valueList.get(1).getAsLong(), trunc ? RoundingMode.DOWN : RoundingMode.HALF_UP));
    }
Holds implementations for functions in Formula
main/src/main/java/cgeo/geocaching/utils/formulas/FormulaUtils.java