File tree 1 file changed +15
-0
lines changed
include/boost/math/special_functions 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)
430
430
{
431
431
return boost::math::log1p (x, policies::policy<>());
432
432
}
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
+
433
448
//
434
449
// Compute log(1+x)-x:
435
450
//
You can’t perform that action at this time.
0 commit comments