I seem to remember from my early days of programming with Pascal, that expressions with mixed types of numbers were not dealt with as well as I would have liked. And while Pascal was my first favourite language, it does a small number of faults, and this seemed to be one of them.
Unfortunately, I can't remember the rules; none of the Pascal books I have discuss this in enough detail, so I can't be specific.
Here is some of my recent code that was generating an overflow:
var R,M:single;var V:int32;
R:= R + (V * M)
I'm not sure where the overflow was happening, but the final value assigned to the variable "R" was 1, so I know it wasn't R that was overflowing. I also know that none of the variables used inside the expression had overflowed.
When I forced the compiler to cast to large types, like this, it worked, even though the values passed through the expression were the same:
var R:single;var M:int64;var V:int32;
R:= R + single(int64(V]) * M)
NB the actual code was more complicated than above.. this is just an "illustration".