Added std::assoc_legendre and std::legendre from C++17, 29.9.5 Mathematical special functions [sf.cmath].
Resubmitted parts of Added implementations of five Mathematical Special Functions added in C++17
It is tested with a table of values generated by gcc-8.3.1 and boost-1.66.0 using boost::multiprecision::cpp_bin_float_oct (256bit float).
Notes:
- The float version uses double internally because assoc_legendre will easily overflow for float. But it can be shown that assoc_legendre is bound by a value less than std::numeric_limits<double>::max() for the whole range required by the standard, x in [-1,1], l < 128, and m < 128. (There is a unit test for that and references to the literature in the code.)
So that seemed to be kind of a natural choice to me. Analog to Added std::assoc_laguerre and std::laguerre and boost, the double version is also promoted long double for internal calculations.
- The implementation is inline for the same reason as D60869.
Related revisions: