operator-sum.go: Fixed sum of fraction and float

This commit is contained in:
Celestino Amoroso 2024-05-06 17:16:30 +02:00
parent 3a30d890c6
commit 6ef468408c

View File

@ -56,7 +56,11 @@ func evalPlus(ctx ExprContext, self *term) (v any, err error) {
}
v = &sumList
} else if isFraction(leftValue) || isFraction(rightValue) {
v, err = sumAnyFract(leftValue, rightValue)
if isFloat(leftValue) || isFloat(rightValue) {
v = numAsFloat(leftValue) + numAsFloat(rightValue)
} else {
v, err = sumAnyFract(leftValue, rightValue)
}
} else {
err = self.errIncompatibleTypes(leftValue, rightValue)
}