[pypy-svn] r18624 - in pypy/dist/pypy: annotation module/__builtin__ rpython translator/c/src

arigo at codespeak.net arigo at codespeak.net
Sat Oct 15 14:55:45 CEST 2005


Author: arigo
Date: Sat Oct 15 14:55:43 2005
New Revision: 18624

Modified:
   pypy/dist/pypy/annotation/binaryop.py
   pypy/dist/pypy/module/__builtin__/operation.py
   pypy/dist/pypy/rpython/rfloat.py
   pypy/dist/pypy/translator/c/src/float.h
Log:
removed support for '%' between floats in RPython.
This was broken in genc (didn't check the signs correctly)
and should just be done by calling math.fmod(), which is
explicitely not guaranteed to do the right thing with signs.

Fixed the only place in the interpreter that uses it
and that was causing a buggy round() in pypy-c.



Modified: pypy/dist/pypy/annotation/binaryop.py
==============================================================================
--- pypy/dist/pypy/annotation/binaryop.py	(original)
+++ pypy/dist/pypy/annotation/binaryop.py	Sat Oct 15 14:55:43 2005
@@ -337,7 +337,7 @@
     def union((flt1, flt2)):
         return SomeFloat()
 
-    add = sub = mul = div = truediv = floordiv = mod = union
+    add = sub = mul = div = truediv = union
 
     def pow((flt1, flt2), obj3):
         return SomeFloat()

Modified: pypy/dist/pypy/module/__builtin__/operation.py
==============================================================================
--- pypy/dist/pypy/module/__builtin__/operation.py	(original)
+++ pypy/dist/pypy/module/__builtin__/operation.py	Sat Oct 15 14:55:43 2005
@@ -71,13 +71,8 @@
 
 # ____________________________________________________________
 
-def _floor(f):
-    return f - (f % 1.0)
-
-def _ceil(f):
-    if f - (f % 1.0) == f:
-        return f
-    return f + 1.0 - (f % 1.0)
+from math import floor as _floor
+from math import ceil as _ceil
 
 def round(space, number, ndigits=0):
     """round(number[, ndigits]) -> floating point number

Modified: pypy/dist/pypy/rpython/rfloat.py
==============================================================================
--- pypy/dist/pypy/rpython/rfloat.py	(original)
+++ pypy/dist/pypy/rpython/rfloat.py	Sat Oct 15 14:55:43 2005
@@ -48,11 +48,6 @@
     rtype_truediv         = rtype_div
     rtype_inplace_truediv = rtype_div
 
-    def rtype_mod(_, hop):
-        return _rtype_template(hop, 'mod')
-
-    rtype_inplace_mod = rtype_mod
-
     def rtype_pow(_, hop):
         s_float3 = hop.args_s[2]
         if s_float3.is_constant() and s_float3.const is None:

Modified: pypy/dist/pypy/translator/c/src/float.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/float.h	(original)
+++ pypy/dist/pypy/translator/c/src/float.h	Sat Oct 15 14:55:43 2005
@@ -28,7 +28,6 @@
 #define OP_FLOAT_MUL(x,y,r,err)     r = x * y
 #define OP_FLOAT_DIV(x,y,r,err)     r = x / y
 #define OP_FLOAT_TRUEDIV(x,y,r,err) OP_FLOAT_DIV(x,y,r,err)
-#define OP_FLOAT_MOD(x,y,r,err)     r = fmod(x, y) 
 #define OP_FLOAT_POW(x,y,r,err)     r = pow(x, y) 
 
 /*** conversions ***/



More information about the Pypy-commit mailing list