Sorry to get uptight... and yes math IS OCD.
Anyways I see what you're trying to do with your method VS what I'm trying to do with mine. You're trying to preserve the extra data, the extra 7 shades produced by 8-bits versus 5.
But you can't. You can kinda but not really.
All using a ratio conversion can do is bump the color up a single shade. Since there are no half values here, we are only dealing with 7 shades of difference, 3 bits.
So your method would keep the first 3(or 4?) shades the same, and bump the next 4(or 3?) shades up. So shades 1-3(or 1-4?) are lost, not dumped up. Shades 4-7(or 3-7?) are bumped up to 8.
When you think about it that way, we're disagreeing over a single bit.
*THINKS*
Oh, now I get it! Actually, never mind. I think I prefer your method after all.