Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing

This Question is Closed

carlsmith Group TitleBest ResponseYou've already chosen the best response.0
It's because of the way floats are stored internally. Because a mathematical float can have infinite precision, but, in real life, there's only so much memory to store one in, you get rounding errors. The expression (0.6/0.2), single slash, actually evaluates to 2.9999999999999996, not 3.0 as you'd expect. You are also using the floor division operator I think so that's where it'll be going wrong. The swapped the operators round between Python2 and Python3, so what / or // do are the opposite in each series.
 3 years ago

seannn11 Group TitleBest ResponseYou've already chosen the best response.0
how did u know it evaluated to 2.99999999999996
 3 years ago

JulieNewbie Group TitleBest ResponseYou've already chosen the best response.0
It is explained here http://docs.python.org/tutorial/floatingpoint.html
 3 years ago

carlsmith Group TitleBest ResponseYou've already chosen the best response.0
@seannn11 I just evaluated it interactively.
 2 years ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.