[Gambas-user] numerical error in Gambas??

Jesper Holm jholm at ...381...
Thu Apr 1 00:08:02 CEST 2004


Hi Benoit,

I am a little uneasy reporting this, but it seems that the IF..THEN statement 
is testing the "displayed" value and not the calculated value.

PUBLIC SUB Main()
DIM a AS Float
  FOR a = 1.68 TO 1.70 STEP 0.001
    IF (a * (1/a)) = 1 THEN
      PRINT a, (a * (1/a)),"OK"
    ELSE
      PRINT a, (a * (1/a)),"not OK"
    END IF
  NEXT
END

Does prints some "not OK" values. 

Do you know which parts of Gambas is affected by this bug? I have several of 
that kind of tests in my program.

Also the SELECT..CASE and DO..LOOP structures are affected. (but I guess those 
are derived from the IF..THEN)

Hope it can help narrowing down the problem.

Meanwhile I'll just have to use a bunch of ROUND()'s here and there :-)

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