Message366764
| Author |
serhiy.storchaka |
| Recipients |
docs@python, josh.r, mark.dickinson, rhettinger, rushilu, serhiy.storchaka, steven.daprano, tim.peters |
| Date |
2020年04月19日.08:26:52 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1587284812.29.0.657528967365.issue40269@roundup.psfhosted.org> |
| In-reply-to |
| Content |
I tried to make repr of floats producing a string which rounds up with eval() (see PR 19593).
>>> complex(0.0, 1.0)
1j
>>> complex(0.0, -1.0)
(0-1j)
>>> complex(-0.0, 1.0)
-(0-1j)
>>> complex(-0.0, -1.0)
(-0.0-1j)
>>> complex(1.0, 0.0)
(1+0j)
>>> complex(-1.0, 0.0)
(-1+0j)
>>> complex(1.0, -0.0)
-(-1+0j)
>>> complex(-1.0, -0.0)
-(1+0j)
The largest problem is with complex(-0.0, 0.0) and complex(-0.0, 0.0). The only forms which evaluate to these numbers are:
>>> complex(-0.0, 0.0)
(-0.0-0j)
>>> complex(0.0, -0.0)
-(-0.0-0j)
But it conflicts with the constructor:
>>> complex('(-0.0-0j)')
-(0+0j) |
|