[Gambas-user] numerical error in Gambas??

Jesper Holm jholm at ...381...
Wed Mar 31 21:56:55 CEST 2004


Ok I see,

but it is very important to me, that I know the correct result, and not just 
Gambas :-)

I did some further testing, and it seems that if I use the ROUND() function I 
get the correct result.

PUBLIC SUB Main()
DIM a AS Float
  FOR a = 1.65 TO 1.70 STEP 0.001
    PRINT a,a*(1/a),Round(a*(1/a))
  NEXT
END

outputs:

1.65		0.1	1
1.651	1	1
1.652	0.1	1
1.653	1	1
1.654	1	1
1.655	1	1
1.656	1	1
1.657	1	1
1.658	1	1
1.659	1	1
1.66		1	1
1.661	0.1	1
1.662	1	1
1.663	0.1	1
1.664	1	1
1.665	1	1
1.666	1	1
1.667	1	1
1.668	1	1
1.669	1	1
1.67		1	1
1.671	1	1
1.672	1	1
1.673	1	1
1.674	1	1
1.675	1	1
1.676	1	1
1.677	1	1
1.678	1	1
1.679	1	1
1.68		1	1
1.681	1	1
1.682	1	1
1.683	1	1
1.684	1	1
1.685	1	1
1.686	0.1	1
1.687	0.1	1
1.688	1	1
1.689	1	1
1.69		1	1
1.691	0.1	1
1.692	0.1	1
1.693	1	1
1.694	1	1
1.695	1	1
1.696	1	1
1.697	1	1
1.698	0.1	1
1.699	1	1
1.7		1	1

So maybe a fast patch would be to call the ROUND function before displaying?

I really hope this cuts it, as I really like using Gambas.

Regards,
Jesper


On Wednesday 31 March 2004 21:25, Benoit Minisini wrote:
> On Wednesday 31 March 2004 20:43, Jesper Holm wrote:
> > Hello again,
> >
> > I have not have any response on my problem. Could anyone please confirm
> > that Gambas DO indeed work on multplication/division?
>
> This is a bug in the function that displays the number. Wrong character are
> displayed. But the numerical value calculated is correct.
>
> I will try to fix that as soon as possible. Sorry, I'm very busy...
>
> Regards,




More information about the User mailing list