Skip to content

Commit ac2071f

Browse files
committed
fix negative powers
1 parent a5bb240 commit ac2071f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

evaluator/infix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func evalIntegerInfixExpression(operator string, left, right object.Object, line
219219
case "*":
220220
return &object.Integer{Value: leftVal * rightVal}
221221
case "**":
222-
return &object.Integer{Value: int64(math.Pow(float64(leftVal), float64(rightVal)))}
222+
return &object.Float{Value: float64(math.Pow(float64(leftVal), float64(rightVal)))}
223223
case "/":
224224
x := float64(leftVal) / float64(rightVal)
225225
if math.Mod(x, 1) == 0 {

0 commit comments

Comments
 (0)