Date: Thu, 19 Feb 1998 11:37:47 +0200 (IST) From: Eli Zaretskii To: Gerald Wann cc: djgpp AT delorie DOT com Subject: Re: Infinity? In-Reply-To: <3.0.5.32.19980218130159.007a0100@mail.kudos.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Wed, 18 Feb 1998, Gerald Wann wrote: > cout << "\nExpression evaluates to " << object.f(x) << endl; > > The program contained no divide by zero error traps, and yet when i > purposfully > entered an expression with a divide by zero error, i got output... > > Expression evaluates to Infnity So what are you complaining about? Is this behavior bad? Would you like the program to crash instead? If so, please explain why. Generally, any program that divides by zero enters that big gray area that goes by the handle of ``Undefined Behavior''. In small words, this means: don't assume anything about what happens there. More specifically, the x87 processor will always generate Infinity for such cases, unless it triggers an FP exception first. If exception generation is disabled (by masking appropriate bits in the FPU control word), you will get Infinity.