Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r51565:c5d041657831
Date: 2012-01-21 11:37 +0100
http://bitbucket.org/pypy/pypy/changeset/c5d041657831/

Log:    Special-case in RPython the case of "x ** 2.0".

diff --git a/pypy/rpython/lltypesystem/module/ll_math.py 
b/pypy/rpython/lltypesystem/module/ll_math.py
--- a/pypy/rpython/lltypesystem/module/ll_math.py
+++ b/pypy/rpython/lltypesystem/module/ll_math.py
@@ -292,6 +292,10 @@
     # deal directly with IEEE specials, to cope with problems on various
     # platforms whose semantics don't exactly match C99
 
+    if y == 2.0:
+        return x * x     # this is always a correct answer, and is relatively
+                         # common in user programs.
+
     if isnan(y):
         if x == 1.0:
             return 1.0   # 1**Nan = 1
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to