Message-ID: <3544A5C8.412497C7@wpol.com> From: John Kissell Reply-To: jdk AT wpol DOT com MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: (none) References: <3 DOT 0 DOT 3 DOT 32 DOT 19980423122620 DOT 0068f068 AT ns DOT coba DOT net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 21 Date: Mon, 27 Apr 1998 00:25:18 GMT NNTP-Posting-Host: 208.195.214.66 NNTP-Posting-Date: Sun, 26 Apr 1998 20:25:18 EDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk My bet is on Dist = a negative value! Put a printf in front of the sqrt function to report 'Dist's actual value. Daniel Delorme wrote: > > I have this problem with SIGFPE... > > double DistanceBetweenPoints(strPOINT *Pt1, strPOINT *Pt2) > { > double Dist; > > Dist = pow(fixtof(Pt1->X - Pt2->X), 2)+ > pow(fixtof(Pt1->X - Pt2->X), 2)+ > pow(fixtof(Pt1->X - Pt2->X), 2); > Dist = sqrt(Dist); > printf("Dist = %f\n", Dist); <----- program crashes here with SIGFPE > } > > traceback: > _doprnt+3548 > _doprnt+1574 > printf+20 > DistanceBetweenPoints > > and I #included math.h > > Why would SIGFPE appear in a mere printf ? > What causes SIGFPE anyway ? > If I remove the printf, I get SIGFPE at "if (Dist1[I] <= Dist2[J])" > (Dist1[6] and Dist2[6] are float)