[Python-ideas] Python Float Update

M.-A. Lemburg mal at egenix.com
Tue Jun 2 09:53:03 CEST 2015


On 02.06.2015 08:40, Andrew Barnert via Python-ideas wrote:
> On Monday, June 1, 2015 10:23 PM, "random832 at fastmail.us" <random832 at fastmail.us> wrote:
> 
>> Does IEEE even have anything about arbitrary-precision decimal types
> 
>> (which are what decimal/cdecimal are)?
> 
> Yes.
> 
> When many people say "IEEE float" they still mean 754-1985. This is what C90 was designed to "support without quite supporting", and what C99 explicitly supports, and what many consumer FPUs support (or, in the case of the 8087 and its successors, a preliminary version of the 1985 standard). That standard did not cover either arbitrary precision or decimals; both of those were only part of the companion standard 854 (which isn't complete enough to base an implementation on).
> 
> But the current version of the standard, 754-2008, does cover arbitrary-precision decimal types.
> 
> If I understand the relationship between the standards: 754-2008 was designed to merge 754-1985 and 854-1987, fill in the gaps, and fix any bugs; GDAS was a major influence (the committee chair was GDAS's author); and since 2009 GDAS has gone from being a de facto independent standard to being a more-specific specification of the relevant subset of 754-2008. IBM's hardware and Java library implement GDAS (and therefore implicitly the relevant part of 754-2008); Itanium (partly), C11, the gcc extensions, and Intel's C library implement 754-2008 (or IEC 60559, which is just a republished 754-2008).
> 
> So, my guess is that GDAS makes perfect sense to follow unless Python wants to expose C11's native fixed decimals, or the newer math.h functions from C99/C11/C14, or the other parts of 754-2008 that it doesn't support (like arbitrary-precision binary). My question was just whether someone had actually made that decision, or whether decimal is following GDAS just because that was the obvious decision to make in 2003.

The IBM decimal implementation by Mike Cowlishaw was chosen
as basis for the Python's decimal implementation at the time,
so yes, this was an explicit design choice at the time:

http://legacy.python.org/dev/peps/pep-0327/
http://speleotrove.com/decimal/

According to the PEP, decimal implements IEEE 854-1987 (with some
restrictions).

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jun 02 2015)
>>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
>>> mxODBC Plone/Zope Database Adapter ...       http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611
               http://www.egenix.com/company/contact/


More information about the Python-ideas mailing list