From c05cd4986ea0eec5ce505b5a3fe1d00fe24af093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ata=20Deniz=20Ayd=C4=B1n?= Date: Tue, 16 May 2017 01:38:57 +0300 Subject: [PATCH] --- modp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modp.py b/modp.py index aa886eb..1523609 100644 --- a/modp.py +++ b/modp.py @@ -11,6 +11,8 @@ class ModP(int): return "%d %% %d" % (self, self.p) # arithmetic + def __neg__(self): + return ModP(self.p, self.p - int(self)) def __add__(self, other): return ModP(self.p, int(self) + int(other)) def __radd__(self, other):