Skip to content

Commit 66b27c5

Browse files
committed
Ensure float conversion in exponentiation
Explicitly converts 'other' to float in the exponentiation method to avoid type errors when using non-float numeric types.
1 parent 9c9355f commit 66b27c5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/pyscipopt/expr.pxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ cdef class Expr:
257257
raise TypeError(f"Unsupported base type {type(other)} for exponentiation.")
258258
if other <= 0.0:
259259
raise ValueError("Base of a**x must be positive, as expression is reformulated to scip.exp(x * scip.log(a)); got %g" % other)
260-
return exp(self * log(other))
260+
return exp(self * log(float(other)))
261261

262262
def __neg__(self):
263263
return Expr({v:-c for v,c in self.terms.items()})

0 commit comments

Comments
 (0)