49template <
typename Number>
55 return std::numeric_limits<Number>::digits10;
66template <
typename Number>
71 if (val == 0 or val == 1) {
74 return static_cast<int>(std::ceil(
75 std::nextafter(std::log10(std::fabs(val)), INFINITY)))
86template <
typename Number>
91 }
else if (val ==
static_cast<Number
>(-1)) {
92 return static_cast<int>(std::ceil(std::log10(val)));
94 return static_cast<int>(std::ceil(std::log10(val + 1)));
106template <
typename Number>
112 return static_cast<int>(
113 std::ceil(std::numeric_limits<Number>::digits * std::logb(base)));
115 return static_cast<int>(
116 std::ceil(std::log(std::abs(val) + 1) / std::log(base)))
130template <
typename ForwardIt>
148template <
typename ForwardIt>
This header provides some features of C++17 <type_traits> and other headers for C++14,...
GeneratorWrapper< T > value(T &&value)
typename std::enable_if< B, T >::type enable_if_t
constexpr auto count_digits(Number val, int base) -> int
Calculates the number of digits needed to represent a number in a given base, plus one for negative n...
constexpr auto max_element(ForwardIt first, EndIt last, Compare comp={}) -> ForwardIt
constexpr auto max_count_digits(ForwardIt first, ForwardIt last, int base) -> int
Returns the necessary number of digits to represent the largest value in an input range.