Bug report
Bug description:
>>> "%.f"%(1+1j) Traceback (most recent call last): File "<python-input-27>", line 1, in <module> "%.f"%(1+1j) ~~~~~^^~~~~~ TypeError: must be real number, not complex >>> "%.d"%(1+1j) Traceback (most recent call last): File "<python-input-28>", line 1, in <module> "%.d"%(1+1j) ~~~~~^^~~~~~ TypeError: %d format: a real number is required, not complex
As you can see, trying to format a complex with .d and .f produces two outputs with the same meaning but different expressions.
Expected: same expressions for same meaning.
CPython versions tested on:
3.14
Operating systems tested on:
Windows