[Gambas-user] Math bugs??

Brant Wells bwells at ...475...
Fri Jun 11 17:34:03 CEST 2004


Hey All.

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...

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






More information about the User mailing list