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: 1164f8,7e35f49d4d9340ab X-Google-Attributes: gid1164f8,public X-Google-Thread: 109fba,7e35f49d4d9340ab X-Google-Attributes: gid109fba,public From: "Jeffrey J. Potoff" Subject: Re: Division by zero crashes on DEC should be avoidable! Date: 1998/03/06 Message-ID: <35008C81.167E@rhea.umd.edu>#1/1 X-Deja-AN: 331557492 Content-Transfer-Encoding: 7bit References: <34FF7719.41C6@ned.dem.csiro.au> <6dpumh$27e@camel21.mindspring.com> Content-Type: text/plain; charset=us-ascii Organization: University of Maryland, College Park Mime-Version: 1.0 Newsgroups: comp.sys.dec,comp.lang.c++,comp.unix.programmer Michael C. Grant wrote: > > Your attitude is somewhat unattractive here, especially since you're wrong. > There is a compiler flag to disable floating-point exceptions of this type; > catching signals is a slow and unnecessarily complex solution to the > problem. > > In most scientific contexts, dividing by zero is not only legal but a very > nice idiom. Working with infinity is not particularly difficult. > > In fact, IEEE floating-point standards allow it. What the poster does not > know is that there is a compiler flag in DEC C++ that allows division by > zero and other floating-point exceptions to go unreported. It is on by > default because, admittedly, many people such as yourself and others _don't_ > intend to divide by zero---so those of us that do should know enough to > enable it. I _disagree_ with DEC's choice here, but so be it. > Perhaps this is what you're looking for (try 'man cc') ? -ieee Ensure support of all portable features of the IEEE Standard for Binary Floating-Point Arithmetic (ANSI/IEEE Std 754-1985), including the treatment of denormalized numbers, NaNs, and infinities and the han- dling of error cases. This flag also sets the _IEEE_FP C preprocessor macro. If your program must use IEEE signaling features that are not portable across different IEEE implementations, see the ieee(3) reference page for a discussion of how to access them under the Digital UNIX operating system.