
When using binary operators with operands of different, be aware of the implicit casts.
In particular :
- If any of the operands is of a reference type, unboxing conversion is performed. Then:
- If either operand is of type double, the other is converted to double.
- Otherwise, if either operand is of type float, the other is converted to float.
- Otherwise, if either operand is of type long, the other is converted to long.
- Otherwise, both operands are converted to type int.
which means some errors could happen, especially if one of the operand is converted from a numeric type to double
or float
(see for more details).