# [pypy-svn] r75950 - pypy/branch/fast-forward/pypy/rlib

benjamin at codespeak.net benjamin at codespeak.net
Wed Jul 7 02:07:03 CEST 2010

```Author: benjamin
Date: Wed Jul  7 02:07:01 2010
New Revision: 75950

Modified:
pypy/branch/fast-forward/pypy/rlib/rarithmetic.py
Log:
flooring is quite incorrect

Modified: pypy/branch/fast-forward/pypy/rlib/rarithmetic.py
==============================================================================
--- pypy/branch/fast-forward/pypy/rlib/rarithmetic.py	(original)
+++ pypy/branch/fast-forward/pypy/rlib/rarithmetic.py	Wed Jul  7 02:07:01 2010
@@ -101,10 +101,10 @@
if absx > _2_to_p28:
w = math.log(absx) + _ln2
elif absx > 2.:
-            w = math.log(2. * absx + 1. // (math.sqrt(x * x + 1.) + absx))
+            w = math.log(2. * absx + 1. / (math.sqrt(x * x + 1.) + absx))
else:
t = x * x
-            w = log1p(absx + t // (1. + math.sqrt(1. + t)))
+            w = log1p(absx + t / (1. + math.sqrt(1. + t)))
return copysign(w, x)

def atanh(x):
@@ -117,9 +117,9 @@
return x
if absx < .5:
t = absx + absx
-            t = .5 * log1p(t + t * absx // (1. - absx))
+            t = .5 * log1p(t + t * absx / (1. - absx))
else:
-            t = .5 * log1p((absx + absx) // (1. - absx))
+            t = .5 * log1p((absx + absx) / (1. - absx))
return copysign(t, x)

def log1p(x):
@@ -128,7 +128,7 @@
return x
elif -.5 <= x <= 1.:
y = 1. + x
-            return math.log(y) - ((y - 1.) - x) // y
+            return math.log(y) - ((y - 1.) - x) / y
else:
return math.log(1. + x)

```