In ps 4.4 (function testFindMaxExpenses) why is my answer 1229.95297872 and not 1229.95548986? Help greatly appreciated! http://dpaste.com/533442/

At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

In ps 4.4 (function testFindMaxExpenses) why is my answer 1229.95297872 and not 1229.95548986? Help greatly appreciated! http://dpaste.com/533442/

MIT 6.00 Intro Computer Science (OCW)
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

Hi, As far as I can tell the problem specifies that your answer should be *close* to 1229.95548986, so your numbers look ok. The reason *why* your answer is not the same stems from the fact that floating point representation of numbers (and that's what you get if you use decimal-dot notation in Python) cannot express any number with full precision. As a consequence small errors can accumulate over multiple operations and the final result can be different depending on the number of operations, their order, relative magnitude of numbers and so on. Numerical analysis deals with this kind of problems. That's why floating point numbers are not used for any serious calculations involving money.
Thanks for your response!
Hello, Changing the line in user mmapplebeck code: while test[-1] < 0 or test[-1] > epsilon: To this: while abs(test[-1]) > epsilon: Gave me exact answer as stated in ps4.py: 1229.95548986.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Not the answer you are looking for?

Search for more explanations.

Ask your own question