https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86655
Bug ID: 86655 Summary: std::assoc_legendre should not constrain the value of m Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: kretz at kde dot org Target Milestone: --- https://wg21.link/c.math#sf.cmath.assoc_legendre leaves m unconstrained. __detail::__assoc_legendre_p documents "@param m The order of the associated Legendre function. @f$ m <= l @f$." and throws a domain error if m > l. IIUC correctly, m > l simply implies that the result of std::assoc_legendre is 0. Which is why Wikipedia documents "This equation has nonzero solutions that are nonsingular on [−1, 1] only if ℓ and m are integers with 0 ≤ m ≤ ℓ". If this is correct, then the m <= l restriction should be removed. Otherwise, we'd need to file a defect report to the C++ standard to constrain m.