www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/19/04:37:51

Date: Thu, 19 Feb 1998 11:37:47 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Gerald Wann <photonuv AT kudos DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Infinity?
In-Reply-To: <3.0.5.32.19980218130159.007a0100@mail.kudos.net>
Message-ID: <Pine.SUN.3.91.980219113732.11716F-100000@is>
MIME-Version: 1.0

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019