Newsgroups: comp.lang.lisp
Path: cantaloupe.srv.cs.cmu.edu!das-news.harvard.edu!news2.near.net!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!jussieu.fr!univ-lyon1.fr!news.imag.fr!cosmos.imag.fr!dedieu
From: dedieu@imag.fr (Eric Dedieu)
Subject: Error handling question
Message-ID: <1994Sep1.151605.4798@imag.fr>
Sender: news@imag.fr
Nntp-Posting-Host: cosmos
Organization: Institut Imag, Grenoble, France
Date: Thu, 1 Sep 1994 15:16:05 GMT
Lines: 23

I need a macro that systematically catches an error (in my case, an
underflow error) and returns a given value instead, like in :

(with-minimum-float
  (format t "format: ~A~%" 1.0E-500)
  (list (exp -1000) (/ 1.0E-308 1E50)))

getting:

format: 2.0E-308
(2.0E-308 2.0E-308)

I know how to write particular functions  my-exp, my-*, my-/ etc... to do this
using the basic things I understand about handler-bind and restart-case, but
I can't solve the case of several errors in the same body, each returning the
value. I know how to return 0.0 using the LCL (enabled-floating-point-traps)
construct, too.

Is there a solution ?
-- 
Eric Dedieu  (Eric.Dedieu@imag.fr)
LIFIA - 46 av. Felix Viallet, 38031 Grenoble Cedex, France
Tel: 76 57 46 11  - Fax: 76 57 46 02  - Dom: 76 49 78 80
