Re: Adding floating point numbers

Tech-Archive recommends: Fix windows errors by optimizing your registry




"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message news:g95g8397hbt15tfbbi5itm6ahl58uo0pf2@xxxxxxxxxx

John von Neumann thought floating point was a serious mistake, because anyone who had a
clue as to what he was doing could do everything in integer mode keeping track of the
decimal place (binary decimal place) in their head while writing the code....

As always there is a germ of a point there, but it's horses for courses, and a lot more thought would need to be applied before programs to solve, say, the partial differential equations of fluid dynamics could be written without floating point.

I have almost no floating point in my music software. (For similar reasons.) A CFraction class I have written with integer numerator and denominator members is much more useful.

But over a period of nearly 40 years, I have also written a lot of scientific software to solve complicated equations and double (or REAL*8 when I still have to collaborate with "fortraphone" colleagues) is completely indispensible. But of course if one is writing that kind of software, with error propagation through millions and millions of additions subtractions multiplications and divisions, a good knowledge of numerical maths is absolutely and completely essential.

Having said that, the problem of numbers being stored in binary and printed in decimal is always (in my experience) completely irrelevant there. That only affects input and output. Much more important is (i.a) what happens if your code subtracts two almost identical numbers and uses the result in an important way. Each of the two numbers you have may only have a tiny associated error, but the relative error on the difference can be enormous and completely destroy the accuracy of the code. But this is a problem associated with any representation of numbers which cannot represent them exactly, and I don't think anyone has learned to program pi and e exactly yet :-)

But being here now is almost surreal for those of us whose first dip into the world of computers was for the purpose of solving problems in theoretical physics. We did everything in double precision floating point, and rapidly learned the pitfalls and read books on numerical maths - which had all been formulated in the days when a computer was a little machine on which you turned the handle until a bell rang and then read off the answer. Integers were exotic beasts which were used as loop counters and little else. :-)

Dave
--
David Webber
Author of 'Mozart the Music Processor'
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm

.


Quantcast