PEP 242 Released

Konrad Hinsen hinsen at cnrs-orleans.fr
Thu Mar 22 10:03:54 EST 2001


"Paul F. Dubois" <paul at pfdubois.com> writes:

> PEP: 242
> Title: Numeric Kinds

Looks good overall. I am just wondering how much of a problem this is
in real life - I have used Python on several platforms, and on all of
them a float was an IEEE double.

> Coercion
> 
>     In an expression, coercion between different kinds is to the
>     greater kind.  For this purpose, all complex kinds are "greater
>     than" all floating-point kinds, and all floating-point kinds are
>     "greater than" all integer kinds.

This might lead to a loss of precision when combining a high-precision
float with a low-precision complex number. It would be better to use a
complex type whose precision is determined by coercion between the
real part of the complex number and the other float.

> Open Issues
> 
>     The assertion that a decimal literal means a binary floating-point
>     value of the largest available kind is in conflict with other
>     proposals about Python's numeric model.  This PEP asserts that
>     these other proposals are wrong and that part of them should not
>     be implemented.

Do you mean Moshe Zadka's proposal for rational numbers and
corresponding literals? One could reconcile both proposals by deciding
that Moshe's rationals are equivalent to infinite-precision floats.
Then literals would always be rationals and the kind objects would
convert to the desired float type.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.56.24
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------



More information about the Python-list mailing list