--- a/calculator.py Mon Jan 11 18:28:19 2016 +0200 +++ b/calculator.py Mon Jan 11 18:29:14 2016 +0200 @@ -189,7 +189,10 @@ OperatorSymbols[op.symbol] = [op] def sgn (x): - return cmp (x, 0) + if abs(x) < 1e-10: + return 0 + else: + return x / abs(x) def integerclamp (x, bits, signed): x = x % (2 ** bits)