Date: Sun, 26 Apr 1998 11:49:36 +0300 (IDT) From: Eli Zaretskii To: Daniel Delorme cc: djgpp AT delorie DOT com Subject: Re: your mail In-Reply-To: <3.0.3.32.19980423122620.0068f068@ns.coba.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Thu, 23 Apr 1998, Daniel Delorme wrote: > 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 ? You didn't supply enough information to help you efficiently. Please at least specify what are the values of all the variables involved in the computation which causes SIGFPE. A complete short program which can be compiled would be even nicer. For what it's worth, it seems to me that you have hand-typed the code that you posted, and the actual program is different (you probably meant to use the Y and Z members as well when computing a distance). As an aside, using `pow' to compute a square of a number is a bad idea; multiplying the number by itself is much faster.