zero carry-in on __neg__
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 21 Feb 2020 16:08:16 +0000 (16:08 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 21 Feb 2020 16:08:16 +0000 (16:08 +0000)
src/ieee754/part/partsig.py

index 75417cfdb06c121613c0883a709779bd205131bd..4a2e611baa8ba2cdbc1995dee9eb002442d474e2 100644 (file)
@@ -64,7 +64,8 @@ class PartitionedSignal:
     # unary ops that require partitioning
 
     def __neg__(self):
-        result, _ = self.add_op(self, ~0, carry=0)  # TODO, subop
+        z = Const(0, self.sig.shape())
+        result, _ = self.add_op(self, ~0, carry=z)  # TODO, subop
         return result
 
     # binary ops that don't require partitioning