[Gambas-user] ARghhhhhhhhhhhh!!!!

Rob sourceforge-raindog2 at ...94...
Thu Nov 13 15:14:06 CET 2003


On Thursday 13 November 2003 04:41, Olivier Coquet wrote:
> Dim t as integer
> Dim s as integer
> print t/s   =====> 4 ???????????
> whats wrong, 9/2 = 4.5 not 4
> bug or allucination

In Gambas, if you perform a math operation on two integers, it 
uses integer math.  You can do the equivalent of casting if you 
need to, like so:

print cfloat(t)/s

ought to be enough to flip it over to floating point.... Or just 
declare t or s as a float in the first place.

Rob





More information about the User mailing list