diff --git a/pystencils/interpolation_astnodes.py b/pystencils/interpolation_astnodes.py
index 60f8be2357f166da26b61ea988e333d7e6f7351e..b18c9c40e32c25668ef9d70fd6921f354bc1c261 100644
--- a/pystencils/interpolation_astnodes.py
+++ b/pystencils/interpolation_astnodes.py
@@ -201,7 +201,8 @@ class InterpolatorAccess(TypedSymbol):
                 elif str(self.interpolator.address_mode).lower() == 'mirror':
                     def triangle_fun(x, half_period):
                         saw_tooth = sp.Abs(x) % (2 * half_period)
-                        return (half_period - 1) - sp.Abs(saw_tooth - (half_period - 1))
+                        return sp.Piecewise((saw_tooth, saw_tooth < half_period),
+                                            (2 * half_period - 1 - saw_tooth, True))
                     index = [cast_func(triangle_fun(i, field.shape[dim]),
                                        default_int_type) for (dim, i) in enumerate(index)]
                     sum[channel_idx] += weight * absolute_access(index, channel_idx if field.index_dimensions else ())