From 3d46eb8e836492ac7b89919250d2bc8a95a178e9 Mon Sep 17 00:00:00 2001 From: James Crake-Merani Date: Fri, 11 Oct 2024 11:22:02 +0100 Subject: [PATCH] Fixed simplificiation of 2(2x). --- sasdata/quantities/operations.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sasdata/quantities/operations.py b/sasdata/quantities/operations.py index 133c33e..a54de90 100644 --- a/sasdata/quantities/operations.py +++ b/sasdata/quantities/operations.py @@ -546,6 +546,9 @@ def _clean_ab(self, a, b): # Convert constant "a"*"b" to "a*b" return Constant(a.evaluate({}) * b.evaluate({}))._clean() + elif isinstance(a, ConstantBase) and isinstance(b, Mul) and isinstance(b.a, ConstantBase): + return Mul(Constant(a.evaluate({}) * b.a.evaluate({})), b.b) + elif isinstance(a, Inv) and isinstance(b, Inv): return Inv(Mul(a.a, b.a))