physics: rename mag to dist, optimize

Using the least amount of assignments is probably better. Also, conversion from long double to double is just truncation, so performance-wise, we're cool. We need the extra precision for internal calculations though.