home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / os / os2 / programm / 6621 < prev    next >
Encoding:
Internet Message Format  |  1992-11-23  |  1.9 KB

  1. Path: sparky!uunet!inmos!wraxall.inmos.co.uk!frogland!des
  2. Newsgroups: comp.os.os2.programmer
  3. From: des@inmos.co.uk (David Shepherd)
  4. Subject: Re: I want NaN and Inf to crash program.  Is this possible?
  5. Message-ID: <1992Nov23.121731.15233@wraxall.inmos.co.uk>
  6. X-Newsreader: Tin 1.1 PL5
  7. References: <1eq9snINN8bu@gap.caltech.edu>
  8. Date: Mon, 23 Nov 92 12:17:31 GMT
  9. Lines: 32
  10.  
  11. Brooke Paul Anderson (brooke@cco.caltech.edu) wrote:
  12. : The problem is that, if your program has generated a NaN or an Inf,
  13. : something is definitely wrong, and the calculation needs to be halted.
  14. : To me, having to sprinkle tests all over to check for these conditions
  15. : is just as inconvenient and annoying as trying to catch bad pointers
  16. : in an OS that doesn't have protected memory (like in DOS, where pointers
  17. : can stomp all over the OS until the whole machine locks up).
  18.  
  19. what you need is a full implementation of IEEE-754 where the production
  20. of a NaN or Inf (under most circumstances) can cause a trap to be taken
  21. which could either halt you program or go to a special bit of
  22. fix up code.
  23.  
  24. IEEE-754 uses NaNs and Infs to allow for calculation to procede as far
  25. as possible while tracking the propogation of "dodgy" values. However,
  26. the standard is design around the idea that you should be able to trap
  27. out of your program in these circumstances.
  28.  
  29. However, sticking in all the support for traps etc can be a bit
  30. excessive if you believe that the vast majority of users won't
  31. need it, hence many people only implement the arithmetic core
  32. or IEEE-754.
  33.  
  34. having traps, though, allows all sorts of interesting concepts to
  35. arise like "quiet" and "noisy" NaNs!
  36.  
  37.  
  38. --
  39. --------------------------------------------------------------------------
  40. david shepherd: des@inmos.co.uk or des@inmos.com    tel: 0454-616616 x 625
  41.                 inmos ltd, 1000 aztec west, almondsbury, bristol, bs12 4sq
  42.                 1992: celebrate the quincentenary of columbus getting lost
  43.