Correct typecast of math expression