[Gambas-user] Math bugs??

Fabien Bodard abidoo.too at ...11...
Fri Jun 11 20:31:27 CEST 2004


Le vendredi 11 Juin 2004 17:34, Brant Wells a écrit :
> Hey All.
Hi,
>
> My name is Brant Wells, and I'm from the USA.  I hope this finds
> everyone well...
>
> I have found a bug, I do believe...  If you do something like:


> dim myVar as float
>
> myvar=1/2
>
> Then myvar comes out to be zero, when it should come out to be 0.5...  I
> find this to be true, on ANY DIVISION that gives you a value of less
> than 1...  ie:  1/3, 1/4, 1/10, all return zero...

not a bug ... in gambas say : 1/3.0
The '.' force gambas to return a float result.

By this way gambas take less ressources.

But, it's sure ... you must to be more carefully in you operation writing.

In fact to get a float result you must at less one float number in your 
equation.

Regards,
Fabien Bodard

>
> However, there is a work around for it...  Instead of saying 1/2...  you
> can say 1 * 2 ^-1  (thats 1 x 2 raised to the -1 power).
>
> When you raise a number to the -1 power, you get the equivalent of 1/x
> ... For instance...
> 10^-1 = 1/10=0.02...
>
> So to do any division problem, y ou simply have to do the ^-1 to
> actually get the correct answer...  I really hope this makes sense to
> everybody...
>
> My System is an AMD 2500+, 768 MB Ram, 160gb Hard Drive, running
> Mandrake 10 Community.
>
> Gambas Roxx!
>
> See Ya!
> ~Brant
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the new InstallShield X.
> From Windows to Linux, servers to mobile, InstallShield X is the
> one installation-authoring solution that does it all. Learn more and
> evaluate today! http://www.installshield.com/Dev2Dev/0504
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user




More information about the User mailing list