File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
include/boost/math/special_functions Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -430,6 +430,21 @@ inline typename tools::promote_args<T>::type log1p(T x)
430430{
431431 return boost::math::log1p (x, policies::policy<>());
432432}
433+
434+ // Standard library casts integer inputs of special functions to double so follow precedence
435+ // See: https://en.cppreference.com/w/cpp/numeric/math/log1p
436+ template <BOOST_MATH_ARBITRARY_INTEGER T>
437+ inline tools::promote_args_t <T> log1p (T x)
438+ {
439+ return boost::math::log1p (static_cast <double >(x), policies::policy<>());
440+ }
441+
442+ template <BOOST_MATH_ARBITRARY_INTEGER T, BOOST_MATH_POLICY Policy>
443+ inline tools::promote_args_t <T> log1p (T x, const Policy& pol)
444+ {
445+ return boost::math::log1p (static_cast <double >(x), pol);
446+ }
447+
433448//
434449// Compute log(1+x)-x:
435450//
You can’t perform that action at this time.
0 commit comments