home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 8009 < prev    next >
Encoding:
Text File  |  1993-01-10  |  1.7 KB  |  36 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.54.726675420@ps1.iaee.tuwien.ac.at>
  6. Lines: 22
  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> <Sorokin.50.726427702@ps1.iaee.tuwien.ac.at> <86406@ut-emx.uucp>
  11. Date: Sun, 10 Jan 1993 14:17:00 GMT
  12. Lines: 22
  13.  
  14. In article <86406@ut-emx.uucp> mmigdol@ccwf.cc.utexas.edu (michael a migdol) writes:
  15.  
  16. >
  17. >    Quoting from page 120 of "Turbo Pascal Library Reference" for Round(X: real)
  18. >, " If X is exactly halfway between two whole numbers, the result is the number with the greatest absolute magnitude." I don't believe that it's the "money method" 
  19. >problem. Do you have any other ideas?
  20.  
  21. If you just need a proper rounding, you can look into ANY book which 
  22. contains a description of 8087/287/387 instructions and find the place where 
  23. the rounding setting is described. As far as I remember you must reset a 
  24. coprocessor with a parameter word. Then add just a one asm line into your 
  25. program and that's it. The problem however may occur if your TP program 
  26. performs multiple coprocessor resets. In this case add this statement just 
  27. as a first statement to the procedure, which performs rounding. It could be 
  28. dangerous to place a reset somewhere in the middle, because the program may 
  29. perform some optimization and use a variable in coprocessor stack, which 
  30. will be naturally lost after reset. 
  31.  
  32. If you want to discover the problem, then it may become a valuable 
  33. contribution to TP-BUGS collection. Good luck!
  34.  
  35. Sincerely, 
  36.