delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/27/13:32:58

Message-Id: <3.0.3.32.19980427104650.006936f8@ns.coba.net>
Date: Mon, 27 Apr 1998 10:46:50 -0400
To: djgpp AT delorie DOT com
From: Daniel Delorme <daniel AT coba DOT net>
Subject: SIGFPE
Mime-Version: 1.0

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 -


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