delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/15/16:16:14

Sender: nate AT cartsys DOT com
Message-ID: <3766B1AB.AE8176B0@cartsys.com>
Date: Tue, 15 Jun 1999 13:03:55 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.10 i586)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: FPE
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990615095752 DOT 2646K-100000 AT is>
Reply-To: djgpp AT delorie DOT com

Eli Zaretskii wrote:
> 
> On Mon, 14 Jun 1999, Justin Deltener wrote:
> 
> > I always thought if I get a Floating Point Exception it was because I
> > was dividing by 0!? My program is getting weird FPE's so I made a test
> > program to divide a float by 0, and divide 0.0 by a float. Both gave
> > answers WITHOUT generating an FPE, soooooo, that kinda shoots that
> > theory out the window...
> 
> Floating point exception that is caused by division by zero is masked
> in DJGPP.  A masked exception prevents SIGFPE from being delivered to
> your program, and instead causes the FPU to return an Infinity as the
> result.  (Try printing the result of division by zero, and you will
> see "Inf" instead of a number.)

Note also that integer division by zero is not handled by the FPU and so
cannot be masked.  This will still signal SIGFPE.  (Admittedly
confusing, as it isn't floating point, but it's the closest signal.)
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


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