Math Issue


During development I found that I was subtracting two integer type variables and putting the result in a long type, my experience is the compiler will either complain or just cast it.  I found that if I took the result and defined it as an int it would work, BUT if I typecast the result from int to long to be passed to the long version, it would break without saying there was an Error or Warning (or Info).

Is this the expected bahaviior? Why does CCS not flag it?

The reality is that the motor control loop i am development ends up with wrong result (the difference value) and does not work.

See attached

4 Replies