Commit 60b245f8 authored by Martin Bauer's avatar Martin Bauer
Browse files

Bugfix in C Backend: brackets around multiplication missing

parent 80d58100
......@@ -143,7 +143,7 @@ class CustomSympyPrinter(CCodePrinter):
def _print_Pow(self, expr):
"""Don't use std::pow function, for small integer exponents, write as multiplication"""
if expr.exp.is_integer and expr.exp.is_number and 0 < expr.exp < 8:
return self._print(sp.Mul(*[expr.base] * expr.exp, evaluate=False))
return "(" + self._print(sp.Mul(*[expr.base] * expr.exp, evaluate=False)) + ")"
else:
return super(CustomSympyPrinter, self)._print_Pow(expr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment