This is a universal problem occuring at several places.
In general scalar arguments are treated as having the same type as the scalar of the matrix. This is often correct. In expressions as
a*X where X stores integer and a is a real number, this will result in a being cast to an integer and the whole expression does not lead to the correct result.
Worse, all assign functions treat arguments as having the same scalar type. So even fixing a*X will not always result into the right value.