Re: subtraction of floating point numbers

2012-02-24 Thread Chris Rebert
On Fri, Feb 24, 2012 at 12:41 AM, Jaroslav Dobrek wrote: > Hello, > > when I have Python subtract floating point numbers it yields weird > results. Example: > > 4822.40 - 4785.52 = 36.87992 > > Why doesn't Python simply yield the correct result? It doesn't have a > problem with this: > > 4

Re: subtraction of floating point numbers

2012-02-24 Thread Alain Ketterlin
Jaroslav Dobrek writes: > when I have Python subtract floating point numbers it yields weird > results. Example: > > 4822.40 - 4785.52 = 36.87992 We've had this discussion here one or two days ago... The usual answer is: please read "What Every Computer Scientist Should Know About Float

subtraction of floating point numbers

2012-02-24 Thread Jaroslav Dobrek
Hello, when I have Python subtract floating point numbers it yields weird results. Example: 4822.40 - 4785.52 = 36.87992 Why doesn't Python simply yield the correct result? It doesn't have a problem with this: 482240 - 478552 = 3688 Can I tell Python in some way to do this differently?