home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!email!ps1.iaee.tuwien.ac.at!Sorokin
- From: Sorokin@ps1.iaee.tuwien.ac.at (Sorokin Zhenya)
- Subject: Re: TP 6.0 Strange rounding problem (Debugger is *lying* to me!)
- Message-ID: <Sorokin.50.726427702@ps1.iaee.tuwien.ac.at>
- Lines: 30
- Sender: news@email.tuwien.ac.at
- Nntp-Posting-Host: pc77.iaee.tuwien.ac.at
- Organization: Inst. of General Electronics and Electroengeneering, TU Vienna
- References: <86277@ut-emx.uucp>
- Date: Thu, 7 Jan 1993 17:28:22 GMT
- Lines: 30
-
- In article <86277@ut-emx.uucp> mmigdol@ccwf.cc.utexas.edu (michael a migdol) writes:
-
- > Well, the first statement sets diff to 25.0. The second sets it to 12.5.
- >ToneFreq + diff is then 512.5, and round of this is...
- > 512???
- >
- > The plot thickens even more. If I trace variables up to the last line, and
- >o a watch on Round(ToneFreq + diff), THAT returns 513! But execution of
-
- As far as I remember, coprocessor (or emulator) supports two different
- rounding procedures:
-
- 1. "Money" rounding: 0.5 is rounded to the nearest __EVEN__ number. This
- sort of rounding produces less error in long calculations, because it makes
- rounding go up- and downstairs with equal probability. Thus 512.5-->512.
-
- 2. "Deterministic" rounding, what you wanted to see.
-
- Switching between these modes is possible, but I do not remember the
- mnemonics. I do not know either, whether is it possible to control it in TP,
- and what is the default setting, how often is the math reset and so on.
-
- Difference between watch and evaluation maybe due to the fact, that they
- use different routines/settings.
-
- By the way, can somebody recommend me a good book or databook on 386/387/486,
- with the table of time spend by each operation? The older, the better (to be
- sure it is in the library already).
-
- Regards,
-