Avoid implicit float->int conversion in the calculations of TDOs and only round the value at the final step. Moreover, some hardcoded quantities are replaced by static constants. Tagging @pscholer, @cheidegg for information.