Mail Archives: djgpp/1996/11/30/10:08:09
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 -