delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/23/23:56:46

Mime-Version: 1.0
To: Fabrice ILPONSE <fabrice AT asim DOT lip6 DOT fr>, djgpp AT delorie DOT com
From: Nate Eldredge <nate AT cartsys DOT com>
Subject: Re: (none)
Cc: daniel AT ns DOT coba DOT net
Date: Thu, 23 Apr 1998 20:50:44 -0700
Message-ID: <19980424035042.AAA8293@ppp125.cartsys.com>

At 06:47  4/23/1998 +0200, Fabrice ILPONSE wrote:
>Daniel Delorme wrote:
>> 
>> I have this problem with SIGFPE...
[code snipped]
>> Why would SIGFPE appear in a mere printf ?

The same reason it would appear anywhere else. See below.

>> What causes SIGFPE anyway ?

Basically, anything that causes the coprocessor to generate an exception.
Unless you change its status with `_control87', examples include using
NaN's, sqrt(negative), division by zero, and I think floating-point overflow.

>> If I remove the printf, I get SIGFPE at "if (Dist1[I] <= Dist2[J])"
>>   (Dist1[6] and Dist2[6] are float)

This seems to imply that it is not a bug in `printf', but with your code.
Try stepping through with a debugger and seeing what the offending values
actually are. If no enlightenment occurs, please post the smallest possible
complete compilable example that consistently reproduces the problem.

>	try to use %g or %G instead of %f.

I seriously doubt that will fix the problem; if it does, it would be a
workaround at best, and if there is a bug we would like to fix it.

Nate Eldredge
nate AT cartsys DOT com



- Raw text -


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