Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: Remco Wouts <remco@xray.bmc.uu.se>
Subject: Re: division by zero exceptions ?
Date: 1998/10/27	[thread overview]
Message-ID: <rylnm2ihiy.fsf@xray.bmc.uu.se> (raw)
In-Reply-To: slrn737pv0.5bf.conrad@hive.me.gu.edu.au

conrad@hive.me.gu.edu.au (Conrad Sanderson) writes:

> 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.  
First of all, this is not the correct answer. Dividing by zero is
nonsense. So actually the Alpha is right. What you mean, but what is
completely different, is that when dividing by smaller and smaller
numbers (in the limit /approaching/ zero) the resultant goes to infinity. 

If you don't want to check every divisor and handle exceptions you may 
want to search the documentation to see if you can trap these
exceptions. But that was already suggested by somebody else. 
--
Remco Wouts remco@xray.bmc.uu.se | Dept. of Biochemistry, Uppsala University
tel/fax:+46-18-4714642/511755    | PO Box 576, S-751 23 Uppsala, Sweden.
 WinErr: 00D Window closed - Do not look outside



  parent reply	other threads:[~1998-10-27  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 [this message]
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     ` Toon Moene
1998-10-31  5:00       ` Anthony W. Youngman
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-01  5:00         ` Stefan Davids
1998-11-02  5:00         ` Michal Jaegermann
1998-10-31  5:00     ` Greg Lindahl
1998-11-03  5:00     ` rscanon
1998-10-31  5:00   ` Anthony W. Youngman
1998-11-01  5:00     ` Greg Lindahl
1998-10-31  5:00   ` Bill Metzenthen
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