Issue32737
Created on 2018-02-01 00:08 by ana, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg311393 - (view) | Author: D. Michael Parrish (ana) | Date: 2018-02-01 00:08 | |
>>> version_info (3, 0, 1, 'final', 0) # I know this is an older version---stuck with it at work. # I did not see this issue in the tracker (380 results for nan). # Perhaps there is better documentation for how to use the issue # tracker. Many of the links on the Dealing with Bugs page--- # https://docs.python.org/3/bugs.html#contributing-to-python # ---are not helpful, e.g., 'contribute' just links back the same # page. # # There are similar problems with inf and -inf >>> isnan(float('nan')) True >>> repr(float('nan')) 'nan' >>> '{0:f}'.format(float('nan')) '-1.#IND00' >>> '{0:F}'.format(float('nan')) '-1.#IND00' >>> '{0:g}'.format(float('nan')) '-1.#IND' >>> '{0:G}'.format(float('nan')) '-1.#IND' >>> '{0:.2f}'.format(float('nan')) '-1.#J' # c.f. https://docs.python.org/3/library/string.html#formatspec |
|||
| msg311394 - (view) | Author: Zachary Ware (zach.ware) * ![]() |
Date: 2018-02-01 00:13 | |
I think you need to clarify with whoever is restricting your Python version which version you can actually use: Python 3.0.1 has been out of support for the better part of 10 years now and hardly anybody ever actually used that particular version (aside from me :))
I have confirmed that Python 3.6 (the oldest version which would receive a fix for this at this point) behaves as expected:
In [1]: '{0:f}'.format(float('nan'))
Out[1]: 'nan'
In [2]: '{0:F}'.format(float('nan'))
Out[2]: 'NAN'
In [3]: '{0:g}'.format(float('nan'))
Out[3]: 'nan'
In [4]: '{0:G}'.format(float('nan'))
Out[4]: 'NAN'
In [5]: '{0:.2f}'.format(float('nan'))
Out[5]: 'nan'
|
|||
| msg311395 - (view) | Author: D. Michael Parrish (ana) | Date: 2018-02-01 00:31 | |
Thank you so much for that reply. Maybe with that I can push for an upgrade. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:57 | admin | set | github: 76918 |
| 2018-02-01 00:31:52 | ana | set | messages: + msg311395 |
| 2018-02-01 00:13:05 | zach.ware | set | status: open -> closed nosy:
+ zach.ware resolution: out of date |
| 2018-02-01 00:08:16 | ana | create | |
