[Python-Dev] Caching float(0.0)
nmm1 at cus.cam.ac.uk
Wed Oct 4 13:39:07 CEST 2006
James Y Knight <foom at fuhm.net> wrote:
> This is a really poor argument. Python should be moving *towards*
> proper '754 fp support, not away from it. On the platforms that are
> most important, the C implementations distinguish positive and
> negative 0. That the current python implementation may be defective
> when the underlying C implementation is defective doesn't excuse a
> change to intentionally break python on the common platforms.
Perhaps you might like to think why only IBM POWERx (and NOT the
Cell or most embedded POWERs) is the ONLY mainstream system to have
implemented all of IEEE 754 in hardware after 22 years? Or why
NO programming language has provided support in those 22 years,
and only Java and C have even claimed to?
See Kahan's "How Javas Floating-Point Hurts Everyone Everywhere",
note that C99 is much WORSE, and then note that Java and C99 are
the only languages that have even attempted to include IEEE 754.
You have also misunderstood the issue. The fact that a C implementation
doesn't support it does NOT mean that the implementation is defective;
quite the contrary. The issue always has been that IEEE 754's basic
model is incompatible with the basic models of all programming
languages that I am familiar with (which is a lot). And the specific
problems with C99 are in the STANDARD, not the IMPLEMENTATIONS.
> IEEE 754 is so widely implemented that IMO it would make sense to
> make Python's floating point specify it, and simply declare floating
> point operations on non-IEEE 754 machines as "use at own risk, may
> not conform to python language standard". (or if someone wants to use
> a software fp library for such machines, that's fine too).
Firstly, see the above. Secondly, Python would need MAJOR semantic
changes to conform to IEEE 754R. Thirdly, what would you say to
the people who want reliable error detection on floating-point of
the form that Python currently provides?
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email: nmm1 at cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679
More information about the Python-Dev