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

Tiago A.O.A. wrote:
Don't forget a !~ b, a <~ b, and a >~ b, and the associated __sim__, __nsim__, __ltsim__, and __gtsim__ slots. I'm not at all sure how serious I am right now. It's late, and I have fuzzy recollections of how those kinds of things might have been nice in some past numerical code. And then =~ and !~ could be defined for strings and do regular expression matching! Woo! More operators! With pronouns! Neil

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. -- Greg

On 3/14/08, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
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). -gps

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. -- Greg

On 3/14/08, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
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). -gps
participants (3)
-
Greg Ewing
-
Gregory P. Smith
-
Neil Toronto