Re: Why 3.0/5.0 = 0.59999...

2006-05-09 Thread Grant Edwards
On 2006-05-09, Davy <[EMAIL PROTECTED]> wrote: > When I type 3.0/5.0, the result is 0.5... > > Is there some precision loss? And how to overcome it? Doesn't anybody read the FAQ? Or even browse through current threads before posting? Sheesh. This has been in the FAQ forever, and was answer

Re: Why 3.0/5.0 = 0.59999...

2006-05-09 Thread Jeremy Sanders
Davy wrote: > Is there some precision loss? And how to overcome it? See http://docs.python.org/tut/node16.html for some useful information. -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Why 3.0/5.0 = 0.59999...

2006-05-09 Thread Mirco Wahab
Hi Davy > When I type 3.0/5.0, the result is 0.5... try: >>> print (3.0/5.0) 0.6 > Is there some precision loss? And how to overcome it? Make sure the result gets piped through some floating point con- version (like print, %s etc.) BTW, the 0.59998 value is the "exact" calcul

Re: Why 3.0/5.0 = 0.59999...

2006-05-09 Thread Dale Strickland-Clark
Have you looked at the decimal module? python Python 2.4 (#1, Mar 22 2005, 21:42:42) [GCC 3.3.5 20050117 (prerelease) (SUSE Linux)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from decimal import * >>> Decimal("3")/Decimal("5") Decimal("0.6") >>> I don't s

Why 3.0/5.0 = 0.59999...

2006-05-09 Thread Davy
Hi all, I used to be a Matlab user. And want to use Python to replace some Matlab work. When I type 3.0/5.0, the result is 0.5... Is there some precision loss? And how to overcome it? Any suggestions will be appreciated! Best regards, Davy -- http://mail.python.org/mailman/listinfo/python