This math scares me

Edward Jason Riedy ejr at cs.berkeley.edu
Tue Mar 13 23:16:57 CET 2001


And Costas Menico <costas at meezon.com> writes:
 - Fortunately I discovered I can use "print 5.01 + 5.54" and it does the
 - job. It has the extra intelligence built into it to autoformat

It's called cosmetic rounding, and it's evil.  It tricks you
into believing you have a number you don't.  See 
	W. Kahan, ``Marketing versus Mathematics.''
	http://www.cs.berkeley.edu/~wkahan/MktgMath.pdf
starting on page 13.

Well, ok, there's one circumstance when it's less than purely
evil.  Some laws and regulatory rules mandate certain types of
rounding.  But then it's done with some forethought (and malice?)
and not just silently hoisted upon an unsuspecting programmer.

Jason
-- 



More information about the Python-list mailing list