Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: rscanon@my-dejanews.com
Subject: Re: division by zero exceptions ?
Date: 1998/11/03	[thread overview]
Message-ID: <71nca8$ief$1@nnrp1.dejanews.com> (raw)
In-Reply-To: v1sd879fj1h.fsf@fea.rrd.ornl.gov

Here is a hack I wrote after reading some of the other
post.   I agree with James though.  There should be a
simple switch to have the compiler force an ignore.
The program I was having problems with compiled and ran
fine on several other platforms (IBM/AIX, SGI/IRIS,
SPARC/solaris, INTEL/Linux).  However, it would stop with
a SIGFPE five seconds in on the alpha.  And it wasn't a
divide by zero, it was a underflow of some sort.  Ignoring
the error was fine in this case.  Well, here's  my hack.
Just link this c-code in with the fortran pieces.

--Shane

#include <signal.h>


void blah__();

void setup_fpe__()
{

   signal(SIGFPE,blah__);

}


void blah__()
{


}



In article <v1sd879fj1h.fsf@fea.rrd.ornl.gov>,
  fea@fea.rrd.ornl.gov (James D. Freels) wrote:
> "Shana Tackett" <sltackett@worldnet.att.net> writes:
>
> This is a bad attitude and probably one of the main reasons why the
> Alpha-Linux cannot reach it's full potential.  Unfortunately, you
> don't understand what large legacy code really means.  When you have a
> job to do, and it requires running a code that is several hundred
> thousand lines of source, you don't have time to fix the bad code.
> That is why the DEC Unix compilers have *AS AN OPTION* the ability to
> allow the floating exceptions to occur. [see man f77 and look at
> -fpe1, -fpe2, etc.] We all know it is bad code and should be fixed,
> but until time and money allow it to get fixed, we must live with it
> to get the job done.
>
> So...  Why don't some of you guys who know how to write compilers fix
> gcc/g77 for the Alpha so that we can really use Linux instead.  I
> would love to now, but I can't.
>
> > The Alpha has much better exception handling than the PII. The PII is
> > setting the register to INF upon division
> > by zero and continues processing. To me the Alpha is correct. You have
> > asked the processor to do something
> > which does not make sense and it has reported an error. Whereas the PII has
> > returned an answer which has to
> > interpreted as being an invalid answer. A lot of sloppy mathematical code
> > will run fine on an Intel chip producing
> > a result which really has no meaning. This is not so on an Alpha. It is
> > better to get no answer than an answer
> > which is spurious and can be wrongly interpreted as correct. Hence write
> > and develop your code on the alpha this way it
> > will be thoroughly tested. There are instructions in AXP which allow you to
> > specifiy a function to be called upon
> > a floating point exception and have the function handle the error. So it is
> > possible to get the same result, although
> > I would not want to.
> >
> > This is one of the main reasons for complications for poorly written
> > mathematics code to not be easily ported from
> > Intel to Alpha.
> >
> > Conrad Sanderson <conrad@hive.me.gu.edu.au> wrote in article
> > <slrn737pv0.5bf.conrad@hive.me.gu.edu.au>...
> > > running this C++ program on an Alpha:
> > >
> > > void main() {
> > >         float a = 10.0; float b = 0.0;
> > >         float c = a/b;
> > >         cout << "c = " << c << endl;
> > >         }
> > >
> > > causes "Floating exception   Exit 136", while on Intel PII is says:
> > > "c =    Inf", which is the "correct" answer.
> > >
> > > Is there any way to make the Alpha do the same thing as PII ?
> > > I know about linking with -mieee, but that makes programs run
> > > too slow, so that is not a solution for me.
> > >
> > > I'm using egcs 1.1 without optimization for the above prog.
> > >
> > >
> > > --
> > > Conrad Sanderson - Microelectronic Signal Processing Laboratory
> > > Griffith University, Queensland, Australia
> > > http://spl.me.gu.edu.au   [ under construction ]
> > >
>


-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    



  parent reply	other threads:[~1998-11-03  5:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-26  5:00 division by zero exceptions ? Conrad Sanderson
1998-10-26  5:00 ` Michal Jaegermann
1998-10-27  5:00 ` Remco Wouts
1998-10-28  5:00   ` Nils Faerber
1998-10-31  5:00 ` Shana Tackett
1998-10-30  5:00   ` James D. Freels
1998-10-31  5:00     ` Greg Lindahl
1998-10-31  5:00     ` Toon Moene
1998-10-31  5:00       ` Anthony W. Youngman
1998-11-01  5:00         ` Stefan Davids
1998-11-01  5:00         ` Bill Metzenthen
1998-11-01  5:00           ` Anthony W. Youngman
1998-11-02  5:00             ` Bill Metzenthen
1998-11-02  5:00               ` Conrad Sanderson
1998-11-02  5:00             ` Stefan Davids
1998-11-02  5:00         ` Michal Jaegermann
1998-11-03  5:00     ` rscanon [this message]
1998-10-31  5:00   ` Bill Metzenthen
1998-10-31  5:00   ` Anthony W. Youngman
1998-11-01  5:00     ` Greg Lindahl
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox