diff --git a/scripts/code.py b/scripts/code.py index b22973a1..f78dfaea 100755 --- a/scripts/code.py +++ b/scripts/code.py @@ -120,6 +120,11 @@ class RInt(co.namedtuple('RInt', 'x')): return self.__class__(self.x * other.x) def __truediv__(self, other): + if not other: + if self >= self.__class__(0): + return self.__class__(+mt.inf) + else: + return self.__class__(-mt.inf) return self.__class__(self.x // other.x) def __mod__(self, other): diff --git a/scripts/cov.py b/scripts/cov.py index ef600a20..46261b23 100755 --- a/scripts/cov.py +++ b/scripts/cov.py @@ -121,6 +121,11 @@ class RInt(co.namedtuple('RInt', 'x')): return self.__class__(self.x * other.x) def __truediv__(self, other): + if not other: + if self >= self.__class__(0): + return self.__class__(+mt.inf) + else: + return self.__class__(-mt.inf) return self.__class__(self.x // other.x) def __mod__(self, other): @@ -193,7 +198,7 @@ class RFrac(co.namedtuple('RFrac', 'a,b')): return self.__class__(self.a * other.a, self.b * other.b) def __truediv__(self, other): - return self.__class__(self.a // other.a, self.b // other.b) + return self.__class__(self.a / other.a, self.b / other.b) def __mod__(self, other): return self.__class__(self.a % other.a, self.b % other.b) diff --git a/scripts/csv.py b/scripts/csv.py index 5c65d63c..17cb3bf2 100755 --- a/scripts/csv.py +++ b/scripts/csv.py @@ -114,6 +114,11 @@ class RInt(co.namedtuple('RInt', 'x')): return self.__class__(self.x * other.x) def __truediv__(self, other): + if not other: + if self >= self.__class__(0): + return self.__class__(+mt.inf) + else: + return self.__class__(-mt.inf) return self.__class__(self.x // other.x) def __mod__(self, other): @@ -207,6 +212,11 @@ class RFloat(co.namedtuple('RFloat', 'x')): return self.__class__(self.x * other.x) def __truediv__(self, other): + if not other: + if self >= self.__class__(0): + return self.__class__(+mt.inf) + else: + return self.__class__(-mt.inf) return self.__class__(self.x / other.x) def __mod__(self, other): @@ -279,7 +289,7 @@ class RFrac(co.namedtuple('RFrac', 'a,b')): return self.__class__(self.a * other.a, self.b * other.b) def __truediv__(self, other): - return self.__class__(self.a // other.a, self.b // other.b) + return self.__class__(self.a / other.a, self.b / other.b) def __mod__(self, other): return self.__class__(self.a % other.a, self.b % other.b) diff --git a/scripts/data.py b/scripts/data.py index 25351106..fa820bc6 100755 --- a/scripts/data.py +++ b/scripts/data.py @@ -120,6 +120,11 @@ class RInt(co.namedtuple('RInt', 'x')): return self.__class__(self.x * other.x) def __truediv__(self, other): + if not other: + if self >= self.__class__(0): + return self.__class__(+mt.inf) + else: + return self.__class__(-mt.inf) return self.__class__(self.x // other.x) def __mod__(self, other): diff --git a/scripts/perf.py b/scripts/perf.py index 0eee8be7..539c0934 100755 --- a/scripts/perf.py +++ b/scripts/perf.py @@ -129,6 +129,11 @@ class RInt(co.namedtuple('RInt', 'x')): return self.__class__(self.x * other.x) def __truediv__(self, other): + if not other: + if self >= self.__class__(0): + return self.__class__(+mt.inf) + else: + return self.__class__(-mt.inf) return self.__class__(self.x // other.x) def __mod__(self, other): diff --git a/scripts/perfbd.py b/scripts/perfbd.py index 3ee67b47..1a5b81de 100755 --- a/scripts/perfbd.py +++ b/scripts/perfbd.py @@ -120,6 +120,11 @@ class RInt(co.namedtuple('RInt', 'x')): return self.__class__(self.x * other.x) def __truediv__(self, other): + if not other: + if self >= self.__class__(0): + return self.__class__(+mt.inf) + else: + return self.__class__(-mt.inf) return self.__class__(self.x // other.x) def __mod__(self, other): diff --git a/scripts/stack.py b/scripts/stack.py index ef1090f0..1ae7bf0f 100755 --- a/scripts/stack.py +++ b/scripts/stack.py @@ -110,6 +110,11 @@ class RInt(co.namedtuple('RInt', 'x')): return self.__class__(self.x * other.x) def __truediv__(self, other): + if not other: + if self >= self.__class__(0): + return self.__class__(+mt.inf) + else: + return self.__class__(-mt.inf) return self.__class__(self.x // other.x) def __mod__(self, other): diff --git a/scripts/structs.py b/scripts/structs.py index 50d12c97..043e4303 100755 --- a/scripts/structs.py +++ b/scripts/structs.py @@ -115,6 +115,11 @@ class RInt(co.namedtuple('RInt', 'x')): return self.__class__(self.x * other.x) def __truediv__(self, other): + if not other: + if self >= self.__class__(0): + return self.__class__(+mt.inf) + else: + return self.__class__(-mt.inf) return self.__class__(self.x // other.x) def __mod__(self, other):