[Gambas-user] Ambiguous expression?

Benoît Minisini gambas at ...1...
Wed Mar 10 20:38:16 CET 2010


> You are correct to not suppress it. The warning is correct.
> The actual value of the numbers is not important.
> The expression is ambiguous without the brackets.
>  5 \ (2 * 3) = 0
>  (5 \ 2) * 3 = 6
> 
> This is also ambiguous
> 5/2*3
> 
>  5 / (2 * 3) = 0.833333333333
>  (5 / 2) * 3 = 7.5
> 

This is less ambiguous, because it is commonly known that / and * are 
associative from left to right a * b / c = (a * b) / c.

Regards,

-- 
Benoît Minisini




More information about the User mailing list