www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/20/02:09:11

From: mitch AT duzen DOT com DOT tr
Message-Id: <199802200705.JAA07326@ankara.duzen.com.tr>
Organization: User RFC 822- and 1123-compliant
To: "Lucas Panian" <mpanian AT awinc DOT com>, djgpp AT delorie DOT com
Date: Fri, 20 Feb 1998 09:07:56 +0200
MIME-Version: 1.0
Subject: Re: sqrt() in DJGPP
In-reply-to: <01bd3da9$a0052120$0cf234d1@mpanian.awinc.com>

On 20 Feb 98 Lucas Panian was found to have commented thusly:

> When I try to run my program, it crashes with SIGFPE...I used symify to
> find that it was in the following section of code(all variables are already
> declared)
> 
> 
> A = Y1 * ( Z2 - Z3 ) + Y2 * ( Z3 - Z1 ) + Y3 * ( Z1 - Z2 );
> B = Z1 * ( X2 - X3 ) + Z2 * ( X3 - X1 ) + Z3 * ( X1 - X2 );
> C = X1 * ( Y2 - Y3 ) + X1 * ( Y3 - Y1 ) + X3 * ( Y1 - Y2 );
>  
> Distance = sqrt (A*A + B*B + C*C);
> 
> Normal.X = (A / Distance) + VPoint[0]->Lx;  // It crashes on this line.
> Normal.Y = (B / Distance) + VPoint[0]->Ly;
> Normal.Z = (C / Distance) + VPoint[0]->Lz;
> 
> 
> I'm pretty sure SIGFPE is a 'Not-A-Number' error. I'm pretty sure the bad
> number is 'Distance.'(have done a little bit of detective work...). So,
> they only thing I can think of is an error in the return value of the
> sqrt() function. Am I right in this assumption? Any help would be greatly
> appreciated. Thanks. ;)

I rather believe there is insufficient code to appreciate fully your 
problem.  Probably it is a good idea to post the variable 
declarations as well, and better if you prepare a minimal amount of 
code that is compilable and yet reproduces the run-time error you 
find.  Who knows?  By doing that you just may discover the nature of 
the error yourself.  And there is a 99.5% probability, I 
venture, that the problem is not in a well-tested sqrt() 
library function.  I believe I calculated that probability using the 
sqrt() function myself :)

Mitch Halloran
Research (Bio)chemist
Duzen Laboratories Group
Ankara   TURKEY
mitch AT duzen DOT com DOT tr

other job title:  Sequoia's (dob 12-20-95) daddy

- Raw text -


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