delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/04/30/17:17:34

Date: Sat, 30 Apr 1994 17:11:24 -0400
From: morphine AT whatever DOT cs DOT jhu DOT edu (Michael Phelps)
Sender: morphine AT whatever DOT cs DOT jhu DOT edu
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Floating point exception

>You should say "symify <imagename>" which will list a routine call traceback
>on the screen to indicate what routine it occured.  If you compiled with -g
>it will even tell you what line number in the routine is causing the fault.
Thanks.  I used this technique and found the "Segmentation violation" to be
occurring in an fclose() function; I used fopen() and then fclose() immediately
after that, and then checked to see if the pointer was NULL or not (to see if the file existed or not).  I was under the impression that fclose() merely 
returned if the pointer was null, but using it only if the pointer != NULL 
solved that problem.  Thanks.
	I have another problem now, though:  "Floating point exception".  Using
the symify technique that a couple of you guys suggested showed the problem to
be coming from the following line:
	if (avg_diff < min_diff)
(avg_diff and min_diff are both doubles)
What's the problem there?  And just so that I know, what EXACTLY is a "floating
point exception"?  I could understand if it were something like dividing by
zero or taking the tangent of (pi/2) or something like that, but I don't see how
a simple comparison could do that.
	Okay, now a couple more incidental questions:  why does printf() 
sometimes seem to lag in its printing?  (Sometimes when I use printf(), I won't
see anything on the screen until the program ends.  This DOES NOT occur with
cprintf() and puts(), however.)
	And last, is there an itoa() (integer to ascii) function in gcc?  Right
now, I'm using sprintf() to take over that function, which works just fine; I
just want to know if that function is available anywhere or not.
	Again, thanks for the help.
						---Michael Phelps
						   morphine AT cs DOT jhu DOT edu

- Raw text -


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