add distance algorithm for numerical