From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <199708270953.FAA06255@churchy.gnu.ai.mit.edu> Date: Wed, 27 Aug 1997 05:53:11 -0400 (EDT) From: Craig Burley Subject: Re: SIGFPE with gcc 2.7.2.1 (from alphabits) >| I'm getting a SIGFPE when multiplying together >| two SMALL numbers (~1e-311 and 1e-11). >| The same multiplication on my PC Linux box returns zero >| which is perfectly acceptable. I can find nothing >| in gcc info about this behavior. Is there >| some flag (or?) I can set to correct this? > >Well, I am about to beleive that this should be the correct behaviour >(well, the mathematician's speaking maybe...). I am not sure what the IEEE >standard says about this, but a good solution is to catch the signal and >handle the case as an exception. Hmm...(1e-311 * 1e-11) == (1e-322), right? If you're using an IEEE 754 double-precision multiply, the left operand is certainly not normalized (a denormal); and so is the result. (Smaller than about 5e-324 and you've underflowed the double-precision representation, I believe.) I think some/all Alpha CPUs raise an exception when math operations would result in denormals, with the idea that the software will take over, which I think normally means Linux, or the debugger, or whatever. Maybe however the left operand was obtained involved a path that didn't mind it being a denormal, e.g. a direct load from memory, or maybe even a "friendly" conversion routine that handles denormals directly. I've found things like this in the past, and upgrading to more recent versions of software has helped. Perhaps the program you're running is catching SIGFPE's for some other reason, which might be interfering with the normal handling for software-emulated denormals? Dunno, since I don't yet know much about the UNIX/Linux exception- handling model. (The only system whose model I did know a fair amount about was PRIMOS, which hardly helps here.) -- "Practice random senselessness and act kind of beautiful." James Craig Burley, Software Craftsperson burley@gnu.ai.mit.edu -- To unsubscribe: send e-mail to axp-list-request@redhat.com with 'unsubscribe' as the subject. Do not send it to axp-list@redhat.com