Python, mysql, roundoff problem?

Tim Peters tim.one at home.com
Thu Aug 9 00:54:58 EDT 2001


[Sam Penrose]
> There appear to be two kinds of solutions to the problem of decimal
> arithmethic: real ones and hacks. Real ones seem to require a lot of
> hard work (Aahz Maruch is working on one) or that you be Tim Peters
> (search for FixedPoint.py). Actually, the fifth line of FixedPoint says
> "use at your own risk", so maybe that one isn't real.

That's my 5-word alternative to 20 pages of license text that says the same
thing.  No numeric bug has been reported against FixedPoint.py since the day
it was released, so if "real" has anything to do with reality, you can judge
from that.  But you *still* use it at your own risk <wink -- if you think
I'm going to take on unlimited liability for any stupid-ass thing someone
does with it, you're several dozen million dollars shy of getting me to
agree>.

> Aahz's isn't released yet, AFAIK, so it probably doesn't qualify as
> real yet either.

Not yet, but "someday soon enough".  FixedPoint.py was a quick hack that's
"good enough" for many mundane purposes, but the spec Aahz is implementing
is a comprehensive approach.

> In the hack category, I wrote a module that I use on numbers passed
> into and out of MySQ that works for me <wink>, in that you can do
> sensible arithmetic with it. I posted it here and received almost no
> feedback, which is about what it deserved. If there is any interest, I
> would be happy to post an updated version.

Unfortunately, most of the people who *need* decimal arithmetic aren't
really capable of articulating exactly what or why -- about the best design
guidance I was ever able to get when writing FixedPoint was "well, it should
like act just like release X.Y.Z of product Ultra P38-X2.  What?  Well, no,
it's not documented, but it seems reasonable to me, so you should do that
too.  What?  Well, no, I'm not sure what it does in all cases, but just do
it like it does!  What's the big deal?".  Etc.  With feedback like that,
you're better off making stuff up out of thin air <wink>.

people-know-what-they're-used-to-better-than-they-know-what-they-want-
    ly y'rs  - tim





More information about the Python-list mailing list