From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,7e35f49d4d9340ab X-Google-Attributes: gidfc89c,public X-Google-Thread: 109fba,7e35f49d4d9340ab X-Google-Attributes: gid109fba,public X-Google-Thread: 1164f8,7e35f49d4d9340ab X-Google-Attributes: gid1164f8,public From: Ron Natalie Subject: Re: Division by zero crashes on DEC should be avoidable! Date: 1998/03/06 Message-ID: <35001A45.60E8B7EB@sensor.com>#1/1 X-Deja-AN: 331432604 Content-Transfer-Encoding: 7bit References: <34FF7719.41C6@ned.dem.csiro.au> Content-Type: text/plain; charset=us-ascii Organization: Sensor Systems Mime-Version: 1.0 Newsgroups: comp.sys.dec,comp.lang.c++,comp.unix.programmer Andrew Ellerton wrote: > On other UNIX platforms the application I have to port > to DEC works fine - including handling division by zero > with only a warning, presumably using not-a-number (NaN) > or INF symbols as the result. Sure, I know it should > never try to divide by zero, but it does. On SOME other UNIX platforms. Actually, machines that do not FPE on divide by zero's are the exception in my experience, you're doing an invalid operation, don't you want to know about it? You'll also find the DEC unique in that it will FPE even on doubles from memory that have invalid format (most machines don't FPE until you do an opreation with them). Make sure things are INITIALIZED. > However, the C++ code will crash the entire application > on the DEC 4.0 version when it divides by zero. Is this > solvable by (for example) compiling with a certain switch? > Or is there any other way to stop it from crashing, or do > I have to resort to modifying the code? There might be a compiler option, I don't know. You could also try catching/ignoring SIGFPE, but that's frought with peril.