From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 2066 invoked from network); 8 Mar 1999 18:10:51 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 8 Mar 1999 18:10:51 -0000 Received: from bohr.as.Arizona.EDU (bohr.as.arizona.edu [128.196.209.66]) by mail.redhat.com (8.8.7/8.8.7) with SMTP id NAA05839 for ; Mon, 8 Mar 1999 13:04:46 -0500 Received: from bohr (localhost [127.0.0.1]) by bohr.as.Arizona.EDU (950413.SGI.8.6.12/950213.SGI.AUTOCF) via SMTP id LAA24850 for ; Mon, 8 Mar 1999 11:00:56 -0700 Sender: dave@as.arizona.edu Message-ID: <36E41058.6201@as.arizona.edu> Date: Mon, 08 Mar 1999 11:00:56 -0700 From: Dave Arnett Organization: Steward Observatory X-Mailer: Mozilla 2.01S (X11; I; IRIX64 6.2 IP26) MIME-Version: 1.0 To: axp-list@redhat.com Subject: Re: SIGFPE error on exponential underflow in g77 References: <36DF0303.15FB@as.arizona.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > > Hardware: Alpha, Aspen Systems Durango II, Samsung 21164A-533 > Software: RH 5.2 (alpha), egcs-1.0.3, version 2.90.29 > > Can someone please tell me exactly where to find information on > dealing with the following problem? > > g77 dumps core upon giving the exponential function a value less than > -708 (double precision). However it politely sets to zero a product > which underflows. > > f2c behaves the same. > > Code in C which performs the same mathematics, using gcc with the same > hardware, quietly sets the underflow from the exponential function > to zero. (No, I cannot rewrite all the code in C in a finite time). > > On an intel, RH 5.1, the exponential function politely goes to zero on > underflow, as I would like. > > I compiled and installed a newer release, egcs-1.1.1 version 2.91.60, > which gave the same behavior. > > How can I modify this behavior upon exponential underflow? > > -- We have a solution (and a puzzle). First, thanks to all who responded so quickly and relevantly; for a newbie like me this was an eye-opener. Solution: link libffm or libcpml I first used libffm because of Joachim Wesner's clean description of what to do, from http://people.frankfurt.netsurf.de/Joachim.Wesner I also tried the compact portable math library, from http://www.unix.digital.com/linux/cpml.0.1.tar.gz Both worked beautifully, and reduced my compute time to 70 percent of the previous value. FYI, libffm was about 98 percent as fast as cpml, on my code mix, without tuning. Thus g77 default lib(-lm?) wrapper SIGFPE gcc -lm OK g77 -lfmm wrapper OK g77 -cpml wrapper OK So the puzzle is why it seems to be the interaction between the g77 wrapper and lm which gives the error. I use "error" because for the physics of my simulation, exp(- big number ) should --> zero; but I agree with Greg Lindahl that it occasionally might be useful to know when underflows happen, for algorithmic development. Cheers, Dave