Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Rounding curiosity

Reply
Thread Tools

Rounding curiosity

 
 
PyBo
Guest
Posts: n/a
 
      11-17-2004
What is wrong with this picture:

>>> x = 500000000.0
>>> y = x / (1024 * 1024)
>>> y

476.837158203125
>>> z = round(y, 2)
>>> z

476.83999999999997

Obviously, '476.83999999999997' is not rounded to two
decimal places. Or am I doing something wrong?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
curiosity about java.util.Timer Daisy Java 3 09-12-2005 07:21 PM
out of curiosity =?Utf-8?B?cm9kY2hhcg==?= ASP .Net 2 09-12-2005 01:06 PM
ConfigurationManager and web.config and ASP.NET refresh curiosity =?Utf-8?B?SmF5IEhpbHlhcmQ=?= ASP .Net 1 04-05-2005 04:12 AM
Rounding curiosity PyBo Python 6 11-17-2004 06:18 PM
curiosity-- long links in coding to shorter ones? Richard HTML 2 07-10-2003 05:04 PM



Advertisments