Author: Hakan Ardo <ha...@debian.org> Branch: extradoc Changeset: r3701:859a7d13dc64 Date: 2011-06-16 14:32 +0200 http://bitbucket.org/pypy/extradoc/changeset/859a7d13dc64/
Log: might work on 32bit now diff --git a/talk/iwtc11/benchmarks/sqrt/sqrt.py b/talk/iwtc11/benchmarks/sqrt/sqrt.py --- a/talk/iwtc11/benchmarks/sqrt/sqrt.py +++ b/talk/iwtc11/benchmarks/sqrt/sqrt.py @@ -15,6 +15,7 @@ self.val = int(val * 2**16) else: self.val = val + #assert self.val <= 2147483647>>8 def __add__(self, other): return Fix16(self.val + Fix16(other).val, False) @@ -26,7 +27,7 @@ return Fix16((self.val >> 8) * (Fix16(other).val >> 8), False) def __div__(self, other): - return Fix16((self.val << 16) / Fix16(other).val, False) + return Fix16((self.val << 8) / (Fix16(other).val >> 8), False) def __float__(self): @@ -46,8 +47,8 @@ def __rsub__(self, other): return Fix16(Fix16(other).val - self.val, False) def __rdiv__(self, other): - return Fix16((Fix16(other).val << 16) / self.val, False) + return Fix16((Fix16(other).val << 8) / (self.val >> 8), False) def main(argv): - sqrt(eval(argv[0])(123456), 100000000) + sqrt(eval(argv[0])(123), 100000000) return 'sqrt(%s)' % argv[0] diff --git a/talk/iwtc11/benchmarks/sqrt/test_sqrt.py b/talk/iwtc11/benchmarks/sqrt/test_sqrt.py --- a/talk/iwtc11/benchmarks/sqrt/test_sqrt.py +++ b/talk/iwtc11/benchmarks/sqrt/test_sqrt.py @@ -1,6 +1,6 @@ import math from sqrt import sqrt, Fix16 -for i in range(2,10): +for i in range(2,10) + [123]: print i, sqrt(i), '%4.2f' % sqrt(float(i)), \ '%4.2f' % float(sqrt(Fix16(i))), '%4.2f' % math.sqrt(i) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit