aboutsummaryrefslogtreecommitdiffstats
path: root/mdpoly/operations/exp.py
diff options
context:
space:
mode:
Diffstat (limited to 'mdpoly/operations/exp.py')
-rw-r--r--mdpoly/operations/exp.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mdpoly/operations/exp.py b/mdpoly/operations/exp.py
index 2b17a07..ee90928 100644
--- a/mdpoly/operations/exp.py
+++ b/mdpoly/operations/exp.py
@@ -46,6 +46,13 @@ class PolyExp(BinaryOp, Reducible):
if not isinstance(self.right.value, int):
raise NotImplementedError("Cannot raise to non-integer powers (yet).")
+ if self.right.value == 0:
+ # FIXME: return constant
+ raise NotImplementedError
+
+ elif self.right.value < 0:
+ raise AlgebraicError("Cannot raise to negative powers (yet).")
+
ntimes = self.right.value - 1
return reduce(PolyMul, (var for _ in range(ntimes)), var)