Also, in these messages, would be good to mention the function name, as that may not be visible from the context. Possibly "legendre_p: fabs(x) must be ..."