From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10c696,c887bec98cd793ef X-Google-Attributes: gid10c696,public X-Google-Thread: 111c93,c887bec98cd793ef X-Google-Attributes: gid111c93,public From: "Shana Tackett" Subject: Re: division by zero exceptions ? Date: 1998/10/31 Message-ID: <01be0482$6ebd1e60$45934b0c@default>#1/1 X-Deja-AN: 406884051 References: Organization: AT&T WorldNet Services Newsgroups: comp.os.linux.alpha,comp.os.linux.development.apps 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 wrote in article ... > 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 ] >