- Fix the division by 0, improve comments.

- Avoid doing the division if the result would be outside the ]0,1<<24[ range:
-- if the numerator is nonpositive, ie <=0, truncate the result to 0,
-- if the numerator is greater or equal than the denominator, the result will be outside the allowed range, hence truncate the result to 1<<24.
-- otherwise, the result will be inside the range. Knowing that the denominator is greater than the numerator, if the numerator has the last 24 bits non zero, the denominator can't be less than 1<<24, hence the denominator won't be truncated to 0.
- Add comment details to help who doesn't know math. Big deal!