When dx is larger than dy In the last line 'a' is always. In debug it acts like a is an Int. I don't get it.
The code has undeclared variables.
What is x1? x0? y1? y0?
Second, you divide an integer type by an integer type, you get an integer result. Integer/intergral types include int, short, long, char, and the unsigned varieties of those. If you want floating point, then use float or double types.