[pypy-svn] r47927 - in pypy/dist/pypy/lang/smalltalk: . test

oscar at codespeak.net oscar at codespeak.net
Thu Oct 25 15:47:06 CEST 2007


Author: oscar
Date: Thu Oct 25 15:47:05 2007
New Revision: 47927

Modified:
   pypy/dist/pypy/lang/smalltalk/primitives.py
   pypy/dist/pypy/lang/smalltalk/test/test_primitives.py
Log:
(cbolz, oscar) failing test for square root and fix

Modified: pypy/dist/pypy/lang/smalltalk/primitives.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/primitives.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/primitives.py	Thu Oct 25 15:47:05 2007
@@ -229,6 +229,8 @@
 @stack(1)
 def func(args, (w_float,)): 
     f = unwrap_float(w_float)
+    if f < 0.0:
+        raise PrimitiveFailedError
     w_res = objtable.wrap_float(math.sqrt(f))
     return w_res
 

Modified: pypy/dist/pypy/lang/smalltalk/test/test_primitives.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/test/test_primitives.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/test/test_primitives.py	Thu Oct 25 15:47:05 2007
@@ -284,4 +284,4 @@
 def test_primitive_square_root():
 	assert prim(p.FLOAT_SQUARE_ROOT, [4.0]).value == 2.0
 	assert round(prim(p.FLOAT_SQUARE_ROOT, [2.0]).value,ROUNDING_DIGITS) == round(1.414213562373095,ROUNDING_DIGITS)
-
+	prim_fails(p.FLOAT_SQUARE_ROOT, [-2.0])



More information about the Pypy-commit mailing list