in src/main/java/com/ql/util/express/OperatorOfNumber.java [322:348]
public static Number divideNormal(Number op1, Number op2) throws Exception {
int type1 = OperatorOfNumber.getSeq(op1.getClass());
int type2 = OperatorOfNumber.getSeq(op2.getClass());
int type = Math.max(type1, type2);
if (type == NumberType.NUMBER_TYPE_BYTE) {
return op1.byteValue() / op2.byteValue();
}
if (type == NumberType.NUMBER_TYPE_SHORT) {
return op1.shortValue() / op2.shortValue();
}
if (type == NumberType.NUMBER_TYPE_INT) {
return op1.intValue() / op2.intValue();
}
if (type == NumberType.NUMBER_TYPE_LONG) {
return op1.longValue() / op2.longValue();
}
if (type == NumberType.NUMBER_TYPE_FLOAT) {
return op1.floatValue() / op2.floatValue();
}
if (type == NumberType.NUMBER_TYPE_DOUBLE) {
return op1.doubleValue() / op2.doubleValue();
}
if (type == NumberType.NUMBER_TYPE_BIG_DECIMAL) {
return new BigDecimal(op1.toString()).divide(new BigDecimal(op2.toString()), BigDecimal.ROUND_HALF_UP);
}
throw new QLException("不支持的对象执行了\"/\"操作");
}