Date: Tue, 4 Mar 1997 23:36:55 -0500 (EST) From: Michael Phelps To: Ron T Lewis cc: djgpp AT delorie DOT com Subject: Re: Floating Point??? In-Reply-To: <4b5_9703051119@softtech.brisnet.org.au> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On 5 Mar 1997, Ron T Lewis wrote: > Hello All, > Please can someone help a friend with a floating point problem > he is having whilst writing a trigonomic program which requires floating > point accuracy.. He's using DJGPP V2.1 > > Please don't ask WHY he wants such accuracy cos I don't know.. > > The problem lies below... > > int main() > { > float a; In DJGPP I get your desired answer if you change the above line to: double a; > a=4.00/5.00; > printf("float = %.12f\n",a); > return(1); > } > Ans = 0.800000011921 > > The correct answer should be 0.800000000000 but he gets these extroneous > numbers tacked on the end??? > > He's using a 486/66 and I tried it on my pentium and wound up with the > same result.. > > Can he get 12 point accuracy and if so how?? > > Over to the experts.... :-) > > (OH! Well, Lifes like that Sumtimes) Regards Ron T Lewis > > ___ > X CMPQwk #1.42X UNREGISTERED EVALUATION COPY > ---Michael Phelps morphine AT cs DOT jhu DOT edu CH3 | N / | ______/ | / \ CH2 _____/ \__|__ // \\ / | \\ // \\______/___CH2 \\ \ / \ / \______/ \_____/ / ------ \ / \ OH \ / OH O Morphine