Re: 2.6.1 - simple division

2009-03-14 Thread Steve Holden
farsi...@gmail.com wrote: Thanks all, that's very helpful, sorry to waste your time with a common question. I have tried the decimal module and will definitely keep using it if I need to do this kind of calculation again. I have 1 more question that the floating point article that was linked

Re: 2.6.1 - simple division

2009-03-10 Thread Tim Chase
farsi...@gmail.com wrote: 4 / 5.0 0.84 0.8 * 5 4.0 Start here: http://docs.python.org/tutorial/floatingpoint.html Play with these: 4/5.0 0.84 print 4/5.0 0.8 print repr(4/5.0) 0.84 str(4/5.0) '0.8' repr(4/5.0) '0.80004'

Re: 2.6.1 - simple division

2009-03-09 Thread Lie Ryan
Duncan Booth wrote: farsi...@gmail.com wrote: Thanks all, that's very helpful, sorry to waste your time with a common question. I have tried the decimal module and will definitely keep using it if I need to do this kind of calculation again. Try to remember though that the decimal module

2.6.1 - simple division

2009-03-09 Thread farsight
4 / 5.0 0.84 0.8 * 5 4.0 python 2.6.1 on mac. What the hell is going on here? -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.6.1 - simple division

2009-03-09 Thread Mohammad Tayseer
: Sunday, March 8, 2009 4:16:53 PM Subject: 2.6.1 - simple division 4 / 5.0 0.84 0.8 * 5 4.0 python 2.6.1 on mac. What the hell is going on here? -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.6.1 - simple division

2009-03-09 Thread Tim Rowe
2009/3/8 farsi...@gmail.com: 4 / 5.0 0.84 0.8 * 5 4.0 python 2.6.1 on mac. What the hell is going on here? I know this has already been answered in detail, but one thing that it's easy for those new to floating point issues to miss is that fractions that can be expressed

Re: 2.6.1 - simple division

2009-03-08 Thread farsight
On Mar 8, 2:16 pm, farsi...@gmail.com wrote: 4 / 5.0 0.84 0.8 * 5 4.0 python 2.6.1 on mac. What the hell is going on here? Pure curiosity prompted me to try the following: 40 / 5.0 8.0 Strange... -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.6.1 - simple division

2009-03-08 Thread Gabriel Genellina
En Sun, 08 Mar 2009 12:22:50 -0200, farsi...@gmail.com escribió: On Mar 8, 2:16 pm, farsi...@gmail.com wrote: 4 / 5.0 0.84 0.8 * 5 4.0 python 2.6.1 on mac. What the hell is going on here? Pure curiosity prompted me to try the following: 40 / 5.0 8.0 Strange... See

Re: 2.6.1 - simple division

2009-03-08 Thread Lie Ryan
farsi...@gmail.com wrote: On Mar 8, 2:16 pm, farsi...@gmail.com wrote: 4 / 5.0 0.84 This one is a common FAQ. Basically floating point is never to be trusted. This issue is quite language agnostic, however some language decided to hide the issue, python does not. For more

Re: 2.6.1 - simple division

2009-03-08 Thread koranthala
On Mar 8, 7:22 pm, farsi...@gmail.com wrote: On Mar 8, 2:16 pm, farsi...@gmail.com wrote: 4 / 5.0 0.84 0.8 * 5 4.0 python 2.6.1 on mac. What the hell is going on here? Pure curiosity prompted me to try the following: 40 / 5.0 8.0 Strange... Please see

Re: 2.6.1 - simple division

2009-03-08 Thread farsight
Thanks all, that's very helpful, sorry to waste your time with a common question. I have tried the decimal module and will definitely keep using it if I need to do this kind of calculation again. I have 1 more question that the floating point article that was linked didn't really answer: x =

Re: 2.6.1 - simple division

2009-03-08 Thread Duncan Booth
farsi...@gmail.com wrote: Thanks all, that's very helpful, sorry to waste your time with a common question. I have tried the decimal module and will definitely keep using it if I need to do this kind of calculation again. Try to remember though that the decimal module simply replaces one

Re: 2.6.1 - simple division

2009-03-08 Thread farsight
Thanks duncan, thats very helpful. I'll be more careful with floating point numbers in future. -- http://mail.python.org/mailman/listinfo/python-list