Addition operator is not commutative
Posted: Fri Aug 28, 2009 8:11 am
The following code constructs vectors v1 and v3, but results in an error message for the lines which should construct v2 and v4.
Hence, the first (left) variable for the addition operator needs to be of the final type.
Code: Select all
vector(1) v0
scalar alpha = 1
!a = 1
vector v1 = v0+alpha
vector v2 = alpha+v0
vector v3 = v0+!a
vector v4 = !a+v0