Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: Joshua Meeds Newsgroups: scee.yaroze.programming.gnu_compiler Subject: printf works, code doesn't Date: Mon, 13 Apr 1998 20:15:07 -0700 Organization: SCEA News Server Lines: 31 Message-ID: <3532D4BA.49B30CA9@sinclair.net> NNTP-Posting-Host: dreamer.sincom.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.04 [en] (Win95; I) I have an oddity: I am trying to find the slope of a line - the equation for this is (Y2-Y1)/(X2-X1). In my code, I made a function "Slope", as follows: double Slope(int a,int b) { u_long X1,Y1,X2,Y2; double Fun; X1=Dude[a].position.vx; Y1=Dude[a].position.vz; X2=Dude[b].position.vx; Y2=Dude[b].position.vz; printf2("\n%d / %d = %e -- ",Y2-Y1,X2-X1, (Y2-Y1) / (X2-X1)); //printf2 = printf that supports %e Fun=((Y2-Y1) / (X2-X1)); printf("%e",Fun); return (Fun); // Used to be return ((Y2-Y1) / (X2-X1)); - Same thing happened } The weird and annoying thing is that the printf2 shows the correct slope, while Fun doesn't. Fun=0. Does anyone have ANY idea why this is happening? Or an easier way to find the slope of a line? Thanks, - Dreamwriter Dragon dreamer@sinclair.net -==UDIC==-