[libcxx-commits] [PATCH] D58876: Added implementations of five Mathematical Special Functions added in C++17.

Andre Brand via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Mar 2 11:41:22 PST 2019

thebrandre created this revision.
thebrandre added a reviewer: libcxx-commits.
thebrandre added a project: libc++.
Herald added subscribers: jdoerfert, christof.

Added implementations of std::assoc_laguerre, std::assoc_legendre, std::hermite, std::laguerre, and std::legendre as specified in ISO/IEC JTC 1/SC 22/WG 21 N3060 and in the C++17 standard.

The implementations were tested against the implementations of Visual Studio 2017 and libstdc++.
I got the same results up to floating-point precision with one exception:
libstdc++'s implementation of std::assoc_legendre doesn't fully adhere to the standard: it has the (pretty trivial) Condon-Shortley phase term, which is not part of the standard and explicitly excluded on cppreference.com.
Visual Studio 2017 complies to the standard in this respect.
I plan to submit that change to libstdc++ for consistency.

All float versions use double internally! It turns out that float is too small for, e.g, std::assoc_legendre in the range of m, l up to 127. You can pretty easily get NaN with float if you don't want to check for inf in each iteration.
The double implementation doesn't run into this problem in the range specified by the standard.

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58876.189053.patch
Type: text/x-patch
Size: 37695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190302/9a1911e2/attachment-0001.bin>

More information about the libcxx-commits mailing list