mdpm = ((3 * tooth_spacing) * 1000000) / threepulsetimecopy; // changed to multiply numerator by 1000, works fine still
rpm = ((mdpm / 1000000) * 60000) / 360; // converts degrees per micro to rpm
Aside from being set to 0 later, and being printed, though I can't see why, later, these are the only two lines that reverence mdpm.
3 * tooth_spacing * 1000000 is going to be evaluated as int, because 3, tooth_spacing, and 1000000 are all ints.
Well, actually, 1000000 ISN'T an int, but you didn't tell the compiler that it wasn't, so the compiler assumed that it was.
So, the multiplication overflowed. Then, the overflowed value was divided by a float, resulting in a float value, but not the one that you expected. That float was then truncated and stored in mdpm.
You need, as was mentioned earlier, to consider all the operations you are performing, and see where overflow could (not necessarily will) occur, and take action to assure that it does not.
For instance, if the constant 1000000 were 1000000UL, the value will be treated as an unsigned long, instead of an int, and the result of the multiplication would not overflow, since it involves ints promoted to unsigned longs and an unsigned long.