From c55ae38cf1f0a90d91a0502d88aceef5e1e54c39 Mon Sep 17 00:00:00 2001 From: Christoph Alt <christoph.alt@fau.de> Date: Sat, 26 Nov 2022 10:52:03 +0100 Subject: [PATCH] fixed pow printing with decimal exponents --- pystencils/backends/syclbackend.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pystencils/backends/syclbackend.py b/pystencils/backends/syclbackend.py index 1a8ca00b7..493b035ec 100644 --- a/pystencils/backends/syclbackend.py +++ b/pystencils/backends/syclbackend.py @@ -214,10 +214,10 @@ class SyCLSympyPrinter(CustomSympyPrinter): if expr.exp.is_integer and expr.exp.is_number and 0 < expr.exp < 12: return f"({self._print(sp.Mul(*[expr.base] * expr.exp, evaluate=False))})" - if expr.exp.is_integer and 12 <= expr.exp: - ret = pre_fixed_pow(sp.Pow(expr.base, cast_func(expr.exp, base_type))) elif expr.exp.is_integer and -8 < expr.exp < 0: return super()._print_Pow(expr) + if get_type_of_expression(expr.exp) != base_type: + ret = pre_fixed_pow(sp.Pow(expr.base, cast_func(expr.exp, base_type))) else: ret = pre_fixed_pow(expr) -- GitLab