home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 7946 < prev    next >
Encoding:
Text File  |  1993-01-07  |  1.8 KB  |  44 lines

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