Mail Archives: djgpp/1998/02/19/04:37:51
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.
- Raw text -