Re: 2.6.1 - simple division

2009-03-08 Thread farsight
On Mar 8, 2:16 pm, [email protected] 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 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 = 0.8
 >>> x
 0.804
 >>> x * 5
 4.0

Shouldn't I be expecting something like 4.2 ?
--
http://mail.python.org/mailman/listinfo/python-list


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


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