sum and prod now support fraction too

This commit is contained in:
2024-05-01 21:51:43 +02:00
parent e00886b1ed
commit cd6b7982ee
2 changed files with 23 additions and 15 deletions
+4
View File
@@ -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)
}