Test and fix hypermath

Tested (but not very thoroughly) the functions dist, exp, expinv and
correct_point.