When is min(a, b) != min(b, a)?
dickinsm at gmail.com
Mon Jan 28 16:07:08 CET 2008
On Jan 28, 6:50 am, Antoon Pardon <apar... at forel.vub.ac.be> wrote:
> People who somehow made it clear they know how to work with inf, and
> NaN results, would get silent NaN where no exceptions would be thrown.
One other thing: there's an excellent starting point for considering
how things should work, in the form of the Decimal type. This does
exactly what you suggest: by default, users get Python exceptions
instead of NaNs and/or infinities, but the user can override the
defaults to switch off the various traps (Overflow, Invalid, etc.) and
work directly with NaNs and infinities if (s)he prefers.
Note also that decimal.py runs to over 5000 lines of (Python) code!
And that's without having to deal with the vagaries of the C-compiler/
library/OS/hardware, since everything's implemented directly in
Python. A surprisingly small amount of that code is actually 'real'
mathematics: most of it is devoted to dealing correctly with
infinities, NaNs, signed zeros, subnormals, `ideal' exponents, traps,
More information about the Python-list