Message366764
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) |
|
| Date |
User |
Action |
Args |
| 2020-04-19 08:26:52 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, tim.peters, rhettinger, mark.dickinson, steven.daprano, docs@python, josh.r, rushilu |
| 2020-04-19 08:26:52 | serhiy.storchaka | set | messageid: <1587284812.29.0.657528967365.issue40269@roundup.psfhosted.org> |
| 2020-04-19 08:26:52 | serhiy.storchaka | link | issue40269 messages |
| 2020-04-19 08:26:52 | serhiy.storchaka | create | |
|