private static BigDecimal toBigDecimal(Number num) {
        if (num instanceof BigDecimal) {
            return (BigDecimal) num;
        } else {
            return new BigDecimal(num.toString());
        }
    }
MathUtils provides Math related functionality

@author tiwe
querydsl-core/src/main/java/com/querydsl/core/util/MathUtils.java