https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86655
--- Comment #9 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- On Mon, 4 Mar 2019, emsr at gcc dot gnu.org wrote: > Also, the legendre functions should not be onstrained on the argument x > either. > They are just polynomials. The recursions are numerically good in this range > (|x| > 1) also. "Otherwise, the function shall report a domain error for just those argument values for which: the function description's Returns: clause explicitly specifies a domain and those argument values fall outside the specified domain, or [...]" (and the Returns: clause in this case explicitly says "for |x| <= 1", which I read as making that case a domain error even though the function is mathematically defined there). For the corresponding C specification, ISO 24747, there's a Rationale document <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1244.pdf> (not sure if there's any more recent version, or such a rationale for the C++ version) saying "The associated Legendre polynomials are well defined for all m and n; hence the ISO 31 restriction m <= n is omitted. On the other hand, adding the restriction |x| <= 1 simplifies implementation at no apparent hardship to programmers.".