On 03/23/2011 07:49 AM, Richard Fateman wrote:
> On 3/23/2011 6:42 AM, Esben Byskov wrote:
>
> (objecting to round-off in 29.40000000000001)
>
> Note that 1/10 cannot be represented exactly in a finite binary expansion.
I am always surprised by how often this floating point roundoff stuff
comes up. Isn't this like the first chapter in every numerical analysis
or scientific programming textbook? I would think most people interested
in Maxima would be familiar with it.
Even though I know that it's possible to get more precision in IEEE
double floating point, I always assume that floating point numbers are
off in the 12th decimal place just in principle (in reality it's usually
the 14th or 15th for a single operation). Since my input values to any
floating point calculation are rarely accurate to more than 3 or 5
decimal places, I generally use fpprintprec to limit the displayed
precision. often the start of my maxima scripts looks like;
kill(all);
reset();
fpprintprec:5;
I'm glad that people on the list look carefully at the floating point
evaluation of various functions and try to get full precision
internally, but when I do Newton's method I often set
newtonepsilon:1e-5;
For the sort of thing I do it's rarely necessary to get more precision
than this (especially since the quadratic convergence of newton's method
usually means that if you converge, after this threshold is exceeded you
usually have about 10 decimal places of accuracy)
floating point is all about trading off speed and accuracy in a
reasonable way.