home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / lisp / 2065 < prev    next >
Encoding:
Internet Message Format  |  1992-07-21  |  1.4 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!wupost!gumby!yale!yale.edu!think.com!barmar
  2. From: barmar@think.com (Barry Margolin)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: Portable way to prevent underflow errors
  5. Date: 21 Jul 1992 20:42:18 GMT
  6. Organization: Thinking Machines Corporation, Cambridge MA, USA
  7. Lines: 27
  8. Message-ID: <14hsraINNihn@early-bird.think.com>
  9. References: <1114@aplcomm.JHUAPL.EDU>
  10. NNTP-Posting-Host: telecaster.think.com
  11.  
  12. In article <1114@aplcomm.JHUAPL.EDU> @mailer.jhuapl.edu:paulmac@stdb.jhuapl.edu (Paul McNamee) writes:
  13. >Thus it seems hard to predict and prevent the later case (by not calling it).
  14. >In my case the obvious solution of returning zero is quite acceptable.
  15. >Symbolics supports this with a without-floating-underflow-traps macro.
  16. >Does Lucid provide a utility for this?  
  17.  
  18. Lucid has WITH-FLOATING-POINT-TRAPS:
  19.  
  20. > (with-floating-point-traps ('() '(floating-point-underflow))
  21.     (expt .1 500))
  22. 0.0
  23.  
  24. You can also set up a handler for the FLOATING-POINT-UNDERFLOW condition.
  25.  
  26. >Perhaps there is a mathematical way to do this using long-float-epsilon and
  27. >least-positive-double-float, but my horribly deficient mathematical mind
  28. >hasn't thought up one.
  29.  
  30. I don't think so.  You can generally determine whether the result will be
  31. too small, but that won't help if the underflow occurs in an intermediate
  32. computation.
  33.  
  34. -- 
  35. Barry Margolin
  36. System Manager, Thinking Machines Corp.
  37.  
  38. barmar@think.com          {uunet,harvard}!think!barmar
  39.