Added support for distance types without numeric_limits specializations; changed test to use that functionality to ensure that it keeps working; fixes #8490