Out of range floating point number determination



Raymond Toy <toy.raymond at gmail.com> writes:

> It would be nice if we could get gcl to signal errors for IEEE errors
> like overflow, divide-by-zero, and invalid-operation.  I think most
> other lisps have some option to do this.  (I personally don't like float
> operations returning NaN since they propagate forever and I never find
> NaN being useful at the end of some long computation.)
>
> Perhaps Camm can give us the magic gcl options to enable these?
>

Greetings!  I've been looking at this.  I have a local version with some
support, but have questions about what is truly useful.

1) By default, hardware FPE signals are enabled "oneshot", i.e. after
the first occurrence, the enabling command must be reissued to catch the
next.  (This is entirely different from the FPE signal catching
mechanism with sigaction, what is meant here is that FPE signals are not
even sent by the kernel by default without some enabling command.)  I'm
assuming that at the lisp level, one wants a global variable that keeps
the desired behavior, and have the C level signal handler reenable the
FPE signal as desired when caught automatically.  The alternative is to
provide the user with an enabling command that will work once and must
be repeated by the user if so desired.

2) Modern kernels appear to have the ability to enable only certain
types of error, and this level of granularity could be passed to the
lisp user, with some complexity.  divide-by-zero, overflow, underflow,
inexact, and invalid are all separably trapable.  My guess is that a
global enable command is appropriate here.

3) The fault address is typically available.  It could be reported at
the lisp level, but my guess is that the typical lisp user would not
find that useful, unless a reverse lookup of the function name was
performed.  

Take care,
-- 
Camm Maguire			     		    camm at maguirefamily.org
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah