Arithmetic and Slice Conversions
Arithmetic and slice conversions will be discussed in this lesson.
We'll cover the following...
Arithmetic conversions
There are other conversion rules that are applied for arithmetic operations. In general, automatic arithmetic conversions are applied in the safe direction: from the narrower type to the wider type. Although this rule is easy to remember and is correct in most cases, automatic conversion rules are very complicated, and in the case of signed-to-unsigned conversions, carry some risk of bugs.
The arithmetic conversion rules are the following:
-
If one of the values is
real
, then the other value is converted to ...