As an aside, the sequence of events you report contains the explanation: You already know the (undesired truncated integer) result of
val1/val2
because you started by printing that directly. Assigning it to a variable, floating point or not, will not change that result ;-).