Mail Archives: djgpp/1998/04/23/23:56:46
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 -