Re: Really strange problem, for very bright people

"Toomas Piibe" <[email protected]> Sat, 9 Aug 2003 22:26:40 +0300
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <[email protected]>
----- Original Message ----- 
From: "mikidavme" <[email protected]>

>
>
> In a previous post the question was raised 'how is a developer
> supposed to understand in what order to write the calculations,
> unless the bug actually manifests itself?'
>
> Two points here:
> (1) There is a surprisingly large literature on the subject of how to
> arrange the order of calculations to minimise problems.  It mostly
> dates back to the very early days of computers.  On the whole though,
> the effort is usually not worth it.  Really the best thing is to
> realise that floating point arithmetic is by its nature inexact, and
> not to expect theoretically zero answers to be exactly zero.  99.99%
> of the time this is adequate.  If you really do have calculations
> where this is not acceptable, don't use floating point.  This is the
> reason for the existence of the 'currency' type.  However, this has a
> small and fixed number of decimal places.  There are other methods of
> doing exact arithmetic, but you would have to consult textbooks on
> numerical methods.
>

Most of these problems in these old books are solved by modern compilers.
Back then there was (and is somewhat now but much less significant) more
than only rounding problem. Modern compilers and processors can usually
eliminate problems like normalization witch IIRC was problem in 1979 with
FORTRAN on IBM mainframe.

These problems why there is special packages for many languages including
Delphi for (scientific) numerical analysis - field where very little  and very
big
numbers and differences in calculating values are usual.


BTW. I looked to original code and compiled it on Delphi. There is probably
is bug in compiler. Watching CPU window I find that all these calculation are
treated as single constant (what I expect)  but they are double not extended
floats. Another reason to use special libraries to numerical analyze.


Toomas



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->

CodeCoffer - new Delphi code protection Tool!
http://www.delphicollection.com/public/CodeCoffer.htm
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/