operator-sum.go: better type checking when adding fractions
This commit is contained in:
parent
6bb891e09d
commit
554ff1a9dd
@ -68,7 +68,7 @@ func evalPlus(ctx ExprContext, self *term) (v any, err error) {
|
||||
sumList = append(sumList, item)
|
||||
}
|
||||
v = &sumList
|
||||
} else if isFraction(leftValue) || isFraction(rightValue) {
|
||||
} else if (isFraction(leftValue) && IsNumber(rightValue)) || (isFraction(rightValue) && IsNumber(leftValue)) {
|
||||
if IsFloat(leftValue) || IsFloat(rightValue) {
|
||||
v = numAsFloat(leftValue) + numAsFloat(rightValue)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user