sum and prod now support fraction too
This commit is contained in:
@@ -42,6 +42,8 @@ func evalMultiply(ctx ExprContext, self *term) (v any, err error) {
|
||||
rightInt, _ := rightValue.(int64)
|
||||
v = leftInt * rightInt
|
||||
}
|
||||
} else if isFraction(leftValue) || isFraction(rightValue) {
|
||||
v, err = mulAnyFract(leftValue, rightValue)
|
||||
} else {
|
||||
err = self.errIncompatibleTypes(leftValue, rightValue)
|
||||
}
|
||||
@@ -85,6 +87,8 @@ func evalDivide(ctx ExprContext, self *term) (v any, err error) {
|
||||
v = leftInt / rightInt
|
||||
}
|
||||
}
|
||||
} else if isFraction(leftValue) || isFraction(rightValue) {
|
||||
v, err = divAnyFract(leftValue, rightValue)
|
||||
} else {
|
||||
err = self.errIncompatibleTypes(leftValue, rightValue)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user