delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/05/00:05:24

Date: Tue, 4 Mar 1997 23:36:55 -0500 (EST)
From: Michael Phelps <morphine AT hops DOT cs DOT jhu DOT edu>
To: Ron T Lewis <ron DOT t DOT lewis AT softtech DOT brisnet DOT org DOT au>
cc: djgpp AT delorie DOT com
Subject: Re: Floating Point???
In-Reply-To: <4b5_9703051119@softtech.brisnet.org.au>
Message-ID: <Pine.GSO.3.95.970304233611.4697C-100000@hops.cs.jhu.edu>
MIME-Version: 1.0

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



- Raw text -


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