dda_maths.c: pick a nugget from @phord's distance calculation rework.