[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [f-cpu] Re: Floating-Point?





> Yes, you will get
> rounding errors but you need a heck of a lot of calculations for the
> rounding errors in the 16'th decimal place to add up to anything of any
> significance.

I just found an article that outlines the problem I stated more precisely
than I can:

http://www.math.grin.edu/~stone/courses/fundamentals/IEEE-reals.html

The article says:

"For instance, 7/5 is 1.4 exactly in decimal numeration, but the .4 part
cannot be expressed as a sum of powers of two; 7/5 has an infinite binary
expansion 1.011001100110011001100..., "

Before such a number is prepared for display, the C standard library for
example does the rounding to a legible number.

So if you write

     printf( "%g\n", 7.0/5.0 );

you might get 1.4 as desired, but internally the number is not correct.

Many years ago, I've been responsible for a development system for business
applications,
which used floating-point arithmetic, and we had error reports from
customers that turned out
as floating-point representation problems. Mind you, we've been using only
2 decimal places.

And the number of calculations didn't matter either. Sometimes after the
first divison, and
sometimes after millions of computations, and the problem was simply that a
value has been
used that could not be represented properly as a floating-point number.


*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/