ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/30/10:08:09

Message-ID: <32A03F1D.4967@pobox.oleane.com>
Date: Sat, 30 Nov 1996 15:05:17 +0100
From: Francois Charton <deef AT pobox DOT oleane DOT com>
Organization: CCMSA
MIME-Version: 1.0
To: afonso AT inesca DOT inesca DOT pt
CC: djgpp AT delorie DOT com
Subject: Re: Problems with DJGPP V2.01 - atof() function
References: <329e68a5 DOT 10316617 AT news DOT ua DOT pt>

afonso AT inesca DOT inesca DOT pt wrote:
> 
>         I think that problem is a bug of DJGPP Library V2.xx.
>         Has someone noticed that problem and corrected it? If they
> have, please let me know about it.
>

Not in the library : I can reproduce your bug without any call to atof() 
or other functions of the kind:

float f;
int i,j;
i=(int) (1.13*100.0);
f=1.13*100.0;
j=(int) f;
printf("%d %d\n",i,j);


prints 112 113...

And this is not because you don't have a FPU : I got a 486DX.
I'd say this is a parsing problem, with the way DJGPP represents 
internally floating point numbers : 

in 
(int) (1.13*100.0)
the result of the multiply seems to be kept with no enough precision

whilst in 
f=1.13*100.0
everything is allright.

Francois

- Raw text -


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