[Python-Dev] Caching float(0.0) (original) (raw)
James Y Knight foom at fuhm.net
Tue Oct 3 21:13:01 CEST 2006
- Previous message: [Python-Dev] Caching float(0.0)
- Next message: [Python-Dev] Caching float(0.0)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Oct 3, 2006, at 2:26 PM, Nick Maclaren wrote:
=?ISO-8859-1?Q?=22Martinv=2EL=F6wis=22?= <martin at v.loewis.de> wrote:
py> x=-0.0 py> y=0.0 py> x,y Nobody is denying that SOME C90 implementations distinguish them, but it is no part of the standard - indeed, a C90 implementation is permitted to use ANY criterion for deciding when to display -0.0 and 0.0. C99 is ambiguous to the point of internal inconsistency, except when STDCIEC559 is set to 1, though the intent is clear. And my reading of Python's code is that it relies on C's handling of such values.
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.
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).
James
- Previous message: [Python-Dev] Caching float(0.0)
- Next message: [Python-Dev] Caching float(0.0)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]