diff options
author | Norbert Preining <norbert@preining.info> | 2022-11-06 03:01:22 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2022-11-06 03:01:22 +0000 |
commit | 0a7c9b85de9aeaffafa0cf8944fa81ffe9652d09 (patch) | |
tree | a8a932b3f786cf3601808c4e352b3b6b07731742 /macros/luatex/latex/luacas/tex/core/binaryoperation/difference.lua | |
parent | 5a47812f51f3d10a580db0c74aa20d73f5ed2ae4 (diff) |
CTAN sync 202211060301
Diffstat (limited to 'macros/luatex/latex/luacas/tex/core/binaryoperation/difference.lua')
-rw-r--r-- | macros/luatex/latex/luacas/tex/core/binaryoperation/difference.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/macros/luatex/latex/luacas/tex/core/binaryoperation/difference.lua b/macros/luatex/latex/luacas/tex/core/binaryoperation/difference.lua new file mode 100644 index 0000000000..2cc56b6600 --- /dev/null +++ b/macros/luatex/latex/luacas/tex/core/binaryoperation/difference.lua @@ -0,0 +1,14 @@ +-- Seperates the various binary operations into their own files for readability + +--- Automatic simplification of difference expressions. +--- @return BinaryOperation +function BinaryOperation:simplifydifference() + local term1 = self.expressions[1] + local term2 = self.expressions[2] + + if not term2 then + return BinaryOperation(BinaryOperation.MUL, {Integer(-1), term1}):autosimplify() + end + + return BinaryOperation(BinaryOperation.ADD, {term1, BinaryOperation(BinaryOperation.MUL, {Integer(-1), term2}):autosimplify()}):autosimplify() +end
\ No newline at end of file |