[Gambas-user] Math bugs??

Nelson Ferraz nferraz at ...184...
Mon Jun 14 22:48:31 CEST 2004


Brant Wells wrote:
> What should the value of 1\3 be?  For every operation that I have done 
> where 1/3 < 1, or  1\3 <1 then I receive 0 (zero) for my answer.  A 
> FLOAT number is not returned...  ie: 6/3 = 2...  and 6\3 = 2... but 1/3 
> = 0, and 1\3 = 0, when really 1/3 should =0.333~

The backslash (\) is the integer division operator, or quotient. In your 
examples it will return zero (as expected).

On the other hand, I agree with you that the non-integer division 
operator (/) shouldn't assume that the result will be integer, even if 
both operands are integer.

[]s

Nelson




More information about the User mailing list