This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Add a a way to determine float format
Type: enhancement Stage: needs patch
Components: Interpreter Core Versions: Python 3.4
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, ezio.melotti, hieu.nguyen, mark.dickinson
Priority: low Keywords:

Created on 2010-07-07 18:25 by benjamin.peterson, last changed 2022-04-11 14:57 by admin.

Messages (2)
msg109488 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-07-07 18:25
At the moment, the only way is float.__getformat__() which is unpleasant and unofficial. Perhaps we could add a member to sys.float_info.
msg173867 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2012-10-26 17:55
What use-cases did you have in mind for this?  (I assume that something motivated this report.)

It seems to me that there's not actually much to say about the float format:  the only format that Python realistically supports these days is the IEEE 754 binary64 format.  (In theory we still support whatever C uses, but in practice I suspect that if we were ever to manage to run Python on a machine whose C doubles *weren't* in binary64 format, we'd see quite a lot of breakage.)

So the only variation that we'll see is little-endian versus big-endian.  We don't even support the ARM OABI mixed-endian format.  Should endianness be considered an important part of the format?
Date User Action Args
2022-04-11 14:57:03adminsetgithub: 53438
2012-10-26 17:55:45mark.dickinsonsetmessages: + msg173867
versions: + Python 3.4, - Python 3.2
2012-10-25 21:38:16ezio.melottisetnosy: + ezio.melotti

stage: needs patch
2012-10-25 21:34:44hieu.nguyensetnosy: + hieu.nguyen
2010-07-07 18:25:58benjamin.petersoncreate