[Python-Dev] Revised decimal type PEP

Guido van Rossum guido@zope.com
Wed, 01 Aug 2001 10:55:02 -0400

> Hmm, am I understanding you explaination?
> Here is a rational expression:
>    9/4 * 4/3 = 3
> With floats this ends up being close, but with rounding errors.
> >>> 2.25*1.333333
> 2.9999992500000001
> >>>
> If this is expressed as a product of 2.25b * 1.333333d the result would be an 
> inexact value.  A binary number would be returned, instead of the decimal 
> number 3.


> Where is Tim's "numeric context" located?  

In his mind. :-)

I believe it is typically global per thread, but that's up to the
langage binding.  A Java binding for Cowlishaw's decimals apparently
requires passing in a context as a third argument on each operation.

> M.-A. Lemburg"  suggested looking at the SQL specification for Decimal 
> datatypes.  A decimal type is also defined as a type in XML Schema.  Since 
> this is an XML datatype there isn't a definition for how these numbers are 
> created.

Do these say anything about semantics under numeric operations?  That
would seem to be outside the realm of XML and possibly even outside
SQL.  So I'm not sure how these help.

>   NOTE: All ˇminimally conformingˇ processors ˇmustˇ support decimal numbers
>   with a minimum of 18 decimal digits (i.e., with a ˇtotalDigitsˇ of 18).
>   However, ˇminimally conformingˇ processors ˇmayˇ set an application-defined
>   limit on the maximum number of decimal digits they are prepared to support,
>   in which case that application-defined maximum number ˇmustˇ be clearly
>   documented.
> 	- http://www.w3.org/TR/xmlschema-2/#decimal

I followed the URL and found only external representation issues,
nothing that can help us.

--Guido van Rossum (home page: http://www.python.org/~guido/)