[math] mark constants as constexpr
Hello all The boost.math library stores quite a few constants for improving performance of various operations (example: boost/math/special_functions/detail/unchecked_factorial.hpp). I was wondering if marking these constants as constexpr would be desirable. Please provide feedback / suggestions so that I can get started :) Lakshay
On 21/08/2017 06:33, Lakshay Garg via Boost wrote:
Hello all
The boost.math library stores quite a few constants for improving performance of various operations (example: boost/math/special_functions/detail/unchecked_factorial.hpp). I was wondering if marking these constants as constexpr would be desirable.
Please provide feedback / suggestions so that I can get started :)
PR's would be welcome as ever ;) We did make everything in boost::math::constants:: constexpr but missed those - the 3 main candidates are the tables of prime numbers, bernoulli numbers and factorials. Some of them may need C++14 constexpr rather than the vanilla C++11 version. We have BOOST_CXX14_CONSTEXPR and BOOST_CONSTEXPR for marking this stuff up in a backwards compatible way BTW. Tests and docs will need updating as well. The unchecked_ functions can probably be noexcept as well. Thanks! John.| | --- This email has been checked for viruses by AVG. http://www.avg.com
On 21 August 2017 at 14:39, John Maddock via Boost
On 21/08/2017 06:33, Lakshay Garg via Boost wrote:
Hello all
The boost.math library stores quite a few constants for improving performance of various operations (example: boost/math/special_functions/detail/unchecked_factorial.hpp). I was wondering if marking these constants as constexpr would be desirable.
Please provide feedback / suggestions so that I can get started :)
PR's would be welcome as ever ;)
We did make everything in boost::math::constants:: constexpr but missed those - the 3 main candidates are the tables of prime numbers, bernoulli numbers and factorials. Some of them may need C++14 constexpr rather than the vanilla C++11 version. We have BOOST_CXX14_CONSTEXPR and BOOST_CONSTEXPR for marking this stuff up in a backwards compatible way BTW. Tests and docs will need updating as well. The unchecked_ functions can probably be noexcept as well.
Thanks! John.| |
Thanks for the suggestions! I will send in a PR in a day or two.
On 21 August 2017 at 14:41, Lakshay Garg
On 21 August 2017 at 14:39, John Maddock via Boost
wrote: On 21/08/2017 06:33, Lakshay Garg via Boost wrote:
Hello all
The boost.math library stores quite a few constants for improving performance of various operations (example: boost/math/special_functions/detail/unchecked_factorial.hpp). I was wondering if marking these constants as constexpr would be desirable.
Please provide feedback / suggestions so that I can get started :)
PR's would be welcome as ever ;)
We did make everything in boost::math::constants:: constexpr but missed those - the 3 main candidates are the tables of prime numbers, bernoulli numbers and factorials. Some of them may need C++14 constexpr rather than the vanilla C++11 version. We have BOOST_CXX14_CONSTEXPR and BOOST_CONSTEXPR for marking this stuff up in a backwards compatible way BTW. Tests and docs will need updating as well. The unchecked_ functions can probably be noexcept as well.
Thanks! John.
@john, I was wondering if it would make sense to replace all "static const"s with BOOST_STATIC_CONSTEXPR?
On 21 August 2017 at 18:03, Lakshay Garg
On 21 August 2017 at 14:41, Lakshay Garg
wrote: On 21 August 2017 at 14:39, John Maddock via Boost
wrote:
On 21/08/2017 06:33, Lakshay Garg via Boost wrote:
Hello all
The boost.math library stores quite a few constants for improving performance of various operations (example: boost/math/special_functions/detail/unchecked_factorial.hpp). I was wondering if marking these constants as constexpr would be desirable.
Please provide feedback / suggestions so that I can get started :)
PR's would be welcome as ever ;)
We did make everything in boost::math::constants:: constexpr but missed those - the 3 main candidates are the tables of prime numbers, bernoulli numbers and factorials. Some of them may need C++14 constexpr rather than the vanilla C++11 version. We have BOOST_CXX14_CONSTEXPR and BOOST_CONSTEXPR for marking this stuff up in a backwards compatible way BTW. Tests and docs will need updating as well. The unchecked_ functions can probably be noexcept as well.
Thanks! John.
@john, I was wondering if it would make sense to replace all "static const"s with BOOST_STATIC_CONSTEXPR?
^ by all I meant wherever it would compile successfully :)
participants (2)
-
John Maddock
-
Lakshay Garg