Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jonas Plewinski
pystencils
Commits
60b245f8
Commit
60b245f8
authored
Sep 20, 2017
by
Martin Bauer
Browse files
Bugfix in C Backend: brackets around multiplication missing
parent
80d58100
Changes
1
Hide whitespace changes
Inline
Side-by-side
backends/cbackend.py
View file @
60b245f8
...
...
@@ -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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment