Added missing factoring of the upper-half division remainder into the lower-half calculation. Fixes #5243