Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r51642:f1fb181c13a3 Date: 2012-01-22 12:22 +0100 http://bitbucket.org/pypy/pypy/changeset/f1fb181c13a3/
Log: Special-case "x ** 2" here instead. diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py --- a/pypy/objspace/std/floatobject.py +++ b/pypy/objspace/std/floatobject.py @@ -443,6 +443,8 @@ y = w_float2.floatval # Sort out special cases here instead of relying on pow() + if y == 2.0: # special case for performance: + return W_FloatObject(x * x) # x * x is always correct if y == 0.0: # x**0 is 1, even 0**0 return W_FloatObject(1.0) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit