[Edu-sig] handling money and floats with beginners

Tim Wilson wilson@visi.com
Wed, 2 Oct 2002 13:03:36 -0500


Hi everyone,

I'm struggling a bit with explaining how important it is to handle
floating point numbers correctly when doing calculations with money. My
latest assignment (http://isd197.org/sibley/cs/icp/loancalc_html)
involves calculating and printing a load payment schedule and I want my
students to do things "the right way."

My assignment instructions include a link to the Floating Point
Arithmetic section of the python tutorial, but it's not quite enough.

Does anyone have any code snippets that illustrate the problem clearly
and are understandable by novices? My instructions say that the simplest
approach is to do money-related calculations in pennies. Is that really
the best approach for beginners? I didn't address this issue very well
last year and I'd like to do a better job this time around.

-Tim

-- 
Tim Wilson      |   Visit Sibley online:   | Check out:
Henry Sibley HS |  http://www.isd197.org   | http://www.zope.com
W. St. Paul, MN |                          | http://slashdot.org
wilson@visi.com |  <dtml-var pithy_quote>  | http://linux.com