New submission from Sree <sree...@gmail.com>:
float.hex(float.fromhex("-nan")) returns 'nan'. PyOS_double_to_string seems to check only if it is a NaN, but ignores the sign (unlike its handling of inf a few lines below): <https://github.com/python/cpython/blob/e9e7d284c434768333fdfb53a3663eae74cb995a/Python/pystrtod.c#L903> Issue 5981 (https://bugs.python.org/issue5981) added the ability for fromhex to recognize -nan, but hex should probably have been updated at the same time. Encountered when testing float implementations. ---------- components: Interpreter Core messages: 379979 nosy: sree314 priority: normal severity: normal status: open title: float.hex discards sign from -nan type: behavior versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42210> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com