42template <
typename T,
typename = std::enable_if_t<std::is_
floating_po
int_v<T>>>
43constexpr auto log(T x) -> T {
45 return std::numeric_limits<T>::quiet_NaN();
48 return -std::numeric_limits<T>::infinity();
56 constexpr int max_loops = 1000;
57 for (
int i = 0; i < max_loops; ++i) {
58 T exp_val =
exp(value);
59 T next_value = value - (exp_val - x) / exp_val;
60 if (value == next_value) {
Definition of exp function.
Definition of log1m_maclaurin function.
constexpr auto log1m_maclaurin(T x) -> T
Calculate logarithm of 1 - x.
Namespace of constexpr variables and functions.
constexpr auto exp(T x) -> T
Calculate exponential function .
constexpr auto log(T x) -> T
Calculate logarithm .