[Baypiggies] Numeric precision (was Re: Eric Raymond likes Python)

Delbert Franz ddf at iqdotdt.com
Thu Sep 10 04:08:00 CEST 2009

On Wednesday 09 September 2009, Edward Cherlin wrote:
> APL has a default Print Precision for just this reason, and a way for
> the user to set the number of digits to print throughout a workspace.
> Explicit numeric formatting was also built in. We tend to get more
> people who have at least heard of Numerical Analysis in the APL
> community. Ken Iverson was of the opinion that the rudiments of NA
> (significant digits, anyway) should be taught in grade school, and did
> so himself in an IBM experiment in the 1960s.
I think this is a good idea as well.  Plus students should be taught 
that addition and subtraction are inverses, so are multiplication and 
division, and that multiplication is just repeated addition and division
is a repeated subtraction.  I don't recall ever hearing about the last
two until I got well beyond grade school:)  However, my grade school 
is more than 50 years ago, so I may have forgotten what I was taught

> On Sun, Sep 6, 2009 at 5:13 PM, Delbert Franz<ddf at iqdotdt.com> wrote:
> > The complaint about 1.1 printing as 1.10...01, is just plain lame!
> > When I ask for a variable to be printed without a format given,
> > I want all of what the variable contains.  The protester needs a
> > simple lesson in floating point arithmetic.  Of course too many
> > people in software know practically nothing of floating point and
> > expect the computer to behave like the "real number" system.
> > Simple answer: it does not and never will:)  Get a life and
> > print with a format that cuts off the unavoidable floating-point
> > noise!  If it helps any, gfortran does the same thing and I suspect
> > any other Fortran implementation worth anything would do the same thing.
> > I suspect many developers were never taught much about floating point or if they
> > were, they have forgotten about it.
> Far too many classes on and books about programming languages only
> think to teach the syntax, not the nature of data objects or anything
> else beyond the most superficial semantics. I blame the schools for
> teaching children that math is too hard for them, instead of teaching
> how to learn it effectively in a way that suits each individual
> child's cognitive style.
> Sure, advanced math is hard. Like anything important, it is as hard as
> possible, but no harder. Playing baseball, or the piano, or World of
> Warcraft, for example. We don't say, "I won't learn as much as I can"
> of anything we like, just because the pros are so much better at it.
> Unless peer pressure or institutional pressure says we shouldn't.
I suspect I have learned more math after I finished school (I was a "slow learner"
and took 22 years!) than I did in school.  Of course I have had almost 40 years
of after school to do that:)  It is unfortunate that there is not more emphasis
on the need for continuing to learn after formal education is finished.  In fact, 
I argue one of the primary purposes for "formal education" is learning how to 
learn, that is, getting broad basic knowledge plus a collection of skills
to use when there is no one else around to help you solve a problem.

> > Being a "number cruncher" requires
> > a nearly constant awareness of the various pitfalls of ignoring the
> > differences between floating-point arithmetic and real-number
> > system arithmetic.
> Yup. Subtraction is one of the worst. What's 1.000001 - 1.000000 to
> four significant figures? 0.0000. (The 0 before the decimal point
> doesn't count.) What does the computer give you? 1.000e-6, unless you
> know how to tell it in much greater detail what you really want, which
> involves the intermediate stage, 1.000-1.000.

You are quite right!  A good intro to some of the issues for anyone with 
high school algebra would be:  "Solving a Quadratic Equation on a 
Computer", by George E. Forsythe, appearing in: "The Mathematical Sciences:
A Collection of Essays", National Academy of Sciences, National
Research Council, 1969, pp. 138-152.  What looks so simple with 
"exact arithmetic" is a much more complex task when using the arithmetic
on a computer! 

Finally, I am consistently dismayed by the lack of mathematical ability of
even graduates with degrees in engineering.  Mathematical illiteracy is
a national "scandal".  Perhaps math education is too important to leave
to the mathematicians:)


> > _______________________________________________
> > Baypiggies mailing list
> > Baypiggies at python.org
> > To change your subscription options or unsubscribe:
> > http://mail.python.org/mailman/listinfo/baypiggies
> >
> -- 
> Edward Mokurai (默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر ج) Cherlin
> Silent Thunder is my name, and Children are my nation.
> The Cosmos is my dwelling place, the Truth my destination.
> http://earthtreasury.org/

More information about the Baypiggies mailing list