[Python-ideas] [Python-Dev] The Case Against Floating Point ==

Gregory P. Smith greg at krypto.org
Sat Mar 15 07:15:48 CET 2008

On 3/14/08, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Neil Toronto wrote:
> > Don't forget a !~ b, a <~ b, and a >~ b, and the associated __sim__,
> > __nsim__, __ltsim__, and __gtsim__ slots.
> I think that all of these are a bad idea. In my experience,
> when comparing with a tolerance, you need to think carefully
> about what the appropriate tolerance is for each and every
> comparison. Having a global default tolerance would just
> lead people to write sloppy and unreliable numerical code.

Agreed no quick "fix" for float imprecisions is going to make life better
for programmers beyond the first week.  floats are imprecise.  the sooner
programmers learn that the better.  if you want things that can be compared
without thinking use a decimal and avoid irrational numbers. good luck. ;)

Though I don't use them myself I believe the popular math language packages
like matlab and mathematica may even allow you to compute all values with
second error/precision component that gets mutated properly based on the
computations being done so that you know the accuracy of your result without
manually having to calculate accuracy every step of the way based on the
algorithm and order of floating point operations used.  (if not, its an
interesting idea and could be fleshed out as a pure python object
implementation  by someone who cares about these things to see if enough
people find it useful).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20080315/222afa16/attachment.html>

More information about the Python-ideas mailing list