Fix bug in special-case handling of ibeta_inv. Fix concept test failures with mpfr_class in legendre.hpp and non_central_t.hpp. Fixes #5015.