Python 2.3.7 has the following functions as number converters: float(num), int(num), long(num). But what happened to double(num)?
If my number is a=3.33333 and do round(_,2), the output I get is 3.3300000000000001. I was expecting to see 3.33.
What’s happening to here?
Thank you.
liliya
l_w 0 Newbie Poster
Recommended Answers
Jump to PostThis is a well know and well documented result on PCs due to the use of binary numbers. Our base 10 system also has problems (with numbers like 1/3 or Pi). The explaination at
Jump to Postwhy not go for Python 2.5 ?
Yes, decimal was first included in Python 2.4 http://www.python.org/doc/2.5.2/lib/module-decimal.html On linux, upgrading is as simple as telling the package manager to upgrade. For MS Windows,
Jump to PostThis is the first hit for a Google http://www.taniquetil.com.ar/facundo/bdvfiles/get_decimal.html
Jump to PostYou just have to dig a little bit, although I am making the assumption that version 1.2 is compatible with python2.3. http://sourceforge.net/project/showfiles.php?group_id=104148&package_id=130611&release_id=291663
All 13 Replies
mn_kthompson 3 Junior Poster
l_w 0 Newbie Poster
woooee 814 Nearly a Posting Maven
l_w 0 Newbie Poster
l_w 0 Newbie Poster
Stefano Mtangoo 455 Senior Poster
woooee 814 Nearly a Posting Maven
l_w 0 Newbie Poster
woooee 814 Nearly a Posting Maven
l_w 0 Newbie Poster
woooee 814 Nearly a Posting Maven
l_w 0 Newbie Poster
l_w 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.