Work out number line distance instantly with clear inputs, formula shown and shareable results.
Distance on a number line is the absolute difference |b − a|, which is never negative. The midpoint is the plain average (a + b)/2.
Distance
d = |b − a|
Midpoint
m = (a + b) / 2
The distance is 19 and the midpoint is 2.5.
Distance is a magnitude, so it should not depend on which point you name first.