[pypy-svn] r31753 - pypy/dist/pypy/lib

arigo at codespeak.net arigo at codespeak.net
Sun Aug 27 21:26:56 CEST 2006


Author: arigo
Date: Sun Aug 27 21:26:54 2006
New Revision: 31753

Modified:
   pypy/dist/pypy/lib/_formatting.py
Log:
Avoid calling math.atan2() when computing  '%d' % 0.  (Don't ask)


Modified: pypy/dist/pypy/lib/_formatting.py
==============================================================================
--- pypy/dist/pypy/lib/_formatting.py	(original)
+++ pypy/dist/pypy/lib/_formatting.py	Sun Aug 27 21:26:54 2006
@@ -120,7 +120,7 @@
         # * mwh giggles, falls over
         # still, if we can recognize them, here's the place to do it.
         import math
-        if v < 0 or v == 0 and math.atan2(0, v) != 0:
+        if v < 0 or v == 0 and isinstance(v, float) and math.atan2(0, v) != 0:
             sign = '-'
             v = -v
         else:



More information about the Pypy-commit mailing list