[libcxx-commits] [PATCH] D60234: Added std::assoc_legendre and std::legendre [sf.cmath]

Andre Brand via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 3 15:38:23 PDT 2019


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

Added std::assoc_legendre and std::legendre from C++17, 29.9.5 Mathematical special functions [sf.cmath].

Resubmitted parts of https://reviews.llvm.org/D58876
Compared to the previous differential, I added further unit tests - the comparisons with libstdc++ and msvc are now part of it (comparing to a generated table).

Note: 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.

The integration into libcxx is analog to std:.expint in https://reviews.llvm.org/D59937


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D60234

Files:
  libcxx/include/__cmath
  libcxx/include/cmath
  libcxx/lib/CMakeLists.txt
  libcxx/src/cmath/legendre.cpp
  libcxx/test/std/numerics/legendre/assoc_legendre_basic.pass.cpp
  libcxx/test/std/numerics/legendre/assoc_legendre_comparisons.pass.cpp
  libcxx/test/std/numerics/legendre/assoc_legendre_exceptions.pass.cpp
  libcxx/test/std/numerics/legendre/legendre_basic.pass.cpp
  libcxx/test/std/numerics/legendre/legendre_comparisons.pass.cpp
  libcxx/test/std/numerics/legendre/legendre_exceptions.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60234.193608.patch
Type: text/x-patch
Size: 65507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190403/71419a4b/attachment-0001.bin>


More information about the libcxx-commits mailing list