[Python-Dev] number-sig anyone?

Tim Peters tim.one@home.com
Thu, 26 Jul 2001 00:41:02 -0400


[Skip Montanaro]
> ...
> I realize there is no obviously right numeric model.

There are many that are reasonable, though -- and that's the other half of
the problem.

> If there was, most programming languages would use it and we wouldn't
> need bots like Tim to help guide us through minefields like IEEE 754.

You've never seen a language that supports 754 properly (== as the committee
intended).  Certainly not Python, C or Java.  It's far less a minefield when
properly supported, and was designed to be much saner than previous binary
f.p. systems.  One problem is that languages only support the *corner* of
754 that intersects with 1950's Fortran; the other is that very few chips
other than Pentium support the 754 80-bit extended format that's key to
making binary f.p. much safer for non-experts.  OTOH, the "proper 754
support" in the C99 Annex is a minefield of its own.

> By "right" I mean that we can arrive at a long-term stable numeric
> model that will be accepted by both the Python community as a whole
> *and* by the decision makers who will vote thumbs up or down on
> adopting Python in their organizations.

The danger I see here is that Scheme's "numeric tower" is almost obviously a
reasonable numeric model, but in practice is so vague that you can't really
count on anything beyond simple small-int arithmetic working the same way
across Scheme implementations.  Guido appears to have come to an
appreciation of that model in the abstract, but hoping that there's not much
difference between floats and rationals in practice "because they represent
the same mathematical values" just isn't going to pan out (IMO).  1/49*49
equals 1 or it doesn't; it doesn't using IEEE doubles, it does using
rationals, and the difference will be significant to programs.  Certainly
better to switch from floats to rationals someday than to move in the other
direction, though.

I've come to suspect the issues *may& be complicated <wink>.