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

  1. Path: sparky!uunet!cis.ohio-state.edu!zaphod.mps.ohio-state.edu!usc!isi.edu!venera.isi.edu!tar
  2. From: tar@ISI.EDU (Thomas A. Russ)
  3. Newsgroups: comp.lang.lisp
  4. Subject: Re: Portable way to prevent underflow errors
  5. Message-ID: <21986@venera.isi.edu>
  6. Date: 21 Jul 92 21:23:45 GMT
  7. References: <1114@aplcomm.JHUAPL.EDU>
  8. Sender: news@isi.edu
  9. Reply-To: tar@isi.edu
  10. Organization: USC-ISI
  11. Lines: 24
  12. In-reply-to: paulmac@stdb.jhuapl.edu's message of 21 Jul 92 17:48:46 GMT
  13.  
  14.  
  15.  
  16. You should take a look at the condition handling section in the 2nd
  17. edition of the CommonLisp reference.
  18.  
  19. A simple solution to the immediate problem at hand (which I just tried
  20. under lucid 4.??) Transform
  21.  
  22.     (expt .9 500) ==> 1.32 e-23    but
  23.     (expt .1 500) ==> Error.       and
  24.  
  25. into:
  26.  
  27. (handler-case (expt .9 500)
  28.    (floating-point-underflow nil 0))   ==> 1.32...e-23
  29.  
  30.  
  31. (handler-case (expt .1 500)
  32.    (floating-point-underflow nil 0))   ==> 0
  33.  
  34. --
  35.  
  36. Thomas A. Russ                                             tar@isi.edu    
  37. USC/ISI, 4676 Admiralty Way, Marina del Rey, CA 90292      (310) 822-1511
  38.