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