22#if HI_COMPILER == HI_CC_MSVC
25#if HI_PROCESSOR == HI_CPU_X64
29namespace hi::inline v1 {
31constexpr long long pow10_table[20]{
46 100'000'000'000'000LL,
47 1'000'000'000'000'000LL,
48 10'000'000'000'000'000LL,
49 100'000'000'000'000'000LL,
50 1'000'000'000'000'000'000LL,
53constexpr long long pow10ll(
int x)
noexcept
55 hi_axiom(x >= 0 && x <= 18);
56 return pow10_table[x];
59template<
typename Iterator>
60auto mean(Iterator first, Iterator last)
64 hilet sum = std::reduce(first, last, init);
70template<
typename Iterator,
typename T>
71auto stddev(Iterator first, Iterator last, T mean)
76 hilet tmp = value - mean;
77 return acc + tmp * tmp;
85constexpr void inplace_max(T& a, T
const& b)
noexcept
91constexpr void inplace_min(T& a, T
const& b)
noexcept
97constexpr void inplace_clamp(T& a, T
const& lo, T
const& hi)
noexcept
100 a = std::clamp(a, lo, hi);
104[[nodiscard]]
constexpr T abs(T a)
noexcept
106 return a < T{} ? -a : a;
109template<std::
floating_po
int T>
110[[nodiscard]]
constexpr bool almost_equal(T a, T b)
noexcept
113 return std::abs(a - b) <= e;
This file includes required definitions.
#define hilet
Invariant should be the default for variables.
Definition required.hpp:23