Mail Archives: djgpp/1998/04/27/13:32:58
Thanks to all for your input but its seems I was starting with the
wrong assumption: I thought sqrt or pow was causing SIGFPE
Consider these two very simple functions:
main()
{
int I;
double D;
for (I=1; I<20; I++)
{
D = ReturnDouble(I);
printf(" %f\n", D);
}
}
double ReturnDouble(int I)
{
printf("%d\n", I);
return(I*2);
}
Put each function in a different file and compile them as a project
(I use RHIDE) and you'll get SIGFPE except if you run the program from
the RHIDE editor under win95. But if you do that, although it won't
crash, the output will be wrong.
If the two functions are in the same file, it runs fine.
If printf is commented out, the program crashes at I==8
If printf isn't commented out, the program crashes at I==5
For now I've circumvented the problem by passing a pointer to a double
to my function (instead of it returning a double) but I'd really like
to know what this is all about.
- Raw text -