[Python-ideas] Hexadecimal floating literals

Jim Baker jim.baker at python.org
Thu Sep 21 22:49:11 EDT 2017


On Thu, Sep 21, 2017 at 7:32 PM, Steven D'Aprano <steve at pearwood.info>
wrote:

> On Thu, Sep 21, 2017 at 01:09:11PM -0700, David Mertz wrote:
> > -1
> >
> > Writing a floating point literal requires A LOT more knowledge than
> writing
> > a hex integer.
> >
> > What is the bit length of floats on your specific Python compile?
>
> Are there actually any Python implementations or builds which have
> floats not equal to 64 bits? If not, perhaps it is time to make 64 bit
> floats a language guarantee.
>

Jython passes the hexadecimal float tests in Lib/test/test_float.py, since
Java uses 64-bit IEEE 754 double representation for the storage type of its
double primitive type. (One can further constrain with strictfp, for
intermediate representation, not certain how widely used that would be. I
have never seen it.) In turn, Jython uses such doubles for its PyFloat
implementation.

I wonder if CPython is the only implementation that could potentially
supports other representations, such as found on System/360 (or the
successor z/OS architecture). And I vaguely recall VAX VMS had an
alternative floating point, but is that still around???

- Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20170921/dccd3287/attachment.html>


More information about the Python-ideas mailing list