From: Stefan Voss
Subject: FLOATING-POINT-UNDERFLOW occurred
Date: 
Message-ID: <1o4r85INNok5@irau40.ira.uka.de>
Hi folks,

in Lucid Lisp 4.0.0 on a Sun SPARCstation the following error appears in the
function (expr x n):

>>Error: A condition of type FLOATING-POINT-UNDERFLOW occurred.

LUCID:FLOAT-EXPT:
   Required arg 0 (ARG1): 0.5
   Required arg 1 (ARG2): 9135.0
:C  0: Use de-normalized (or zero) result
:A  1: Abort to Lisp Top Level

In my Common Lisp system there seems to be the macro WITH-FLOATING-POINT-TRAPS,
that might overcome the error and return zero as result instead. I'm afraid,
I don't know how to use this macro. It's not mentioned in CLtL1/2.

Does anybody know what this macro does and how it is applied or how this 
error condition can be avoided ?

Any advice is welcome,

Stefan Voss
(····@ira.uka.de)
From: Barry Margolin
Subject: Re: FLOATING-POINT-UNDERFLOW occurred
Date: 
Message-ID: <1o5iahINNlal@early-bird.think.com>
In article <············@irau40.ira.uka.de> ····@i40s19.ira.uka.de (Stefan Voss) writes:
>in Lucid Lisp 4.0.0 on a Sun SPARCstation the following error appears in the
>function (expr x n):
>
>>>Error: A condition of type FLOATING-POINT-UNDERFLOW occurred.
>
>LUCID:FLOAT-EXPT:
>   Required arg 0 (ARG1): 0.5
>   Required arg 1 (ARG2): 9135.0
>:C  0: Use de-normalized (or zero) result
>:A  1: Abort to Lisp Top Level
>
>In my Common Lisp system there seems to be the macro WITH-FLOATING-POINT-TRAPS,
>that might overcome the error and return zero as result instead. I'm afraid,
>I don't know how to use this macro. It's not mentioned in CLtL1/2.

It's not a standard CL function, it's a Lucid extension.  It's documented
in the Advanced User's Guide in the Lucid manual set, in the "Lucid
Extensions to Common Lisp" section.  Briefly, it's used as follows:

(with-floating-point-traps (enable-list disable-list) body)

ENABLE-LIST and DISABLE-LIST are lists of condition names to enable and
disable; these arguments are evaluated.  BODY is an implicit progn.

>Does anybody know what this macro does and how it is applied or how this 
>error condition can be avoided ?

To disable all floating point error traps, you can do:

(with-floating-point-traps ('() supported-floating-point-conditions)
  ...)

However, a more portable solution is to use the condition system:

(handler-bind ((arithmetic-error
		 #'(lambda (c)
		     (declare (ignore c))
		     (continue))))
  ...)
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

······@think.com          {uunet,harvard}!think!barmar