[Gambas-user] Ambiguous expression?

Doriano Blengino doriano.blengino at ...1909...
Wed Mar 10 19:36:16 CET 2010


Alessandro Rinaldi ha scritto:
> I really think yes.
> Standard symbol for fractions is /, why should you use \?
>   
Backslash is "integer division", and should yeld an integer result. 
Slash is "float" division, and yelds a float number (this is "Basic" 
syntax; other languages use different methods).

The expression "1\2*3" is not really ambiguous, it is only for Gambas 
(don't ask me why); it should be seen as "take an integer number, 
integer-divide it for another integer number, and multiply the result 
for another integer number, giving an integer result".

About integer division, there are other reasons apart from wanting an 
*integer* division: for example is faster.

Regards,
Doriano





More information about the User mailing list