26#if HI_COMPILER == HI_CC_MSVC
29#if HI_PROCESSOR == HI_CPU_X64
33namespace hi::inline
v1 {
35constexpr long long pow10_table[20]{
50 100'000'000'000'000LL,
51 1'000'000'000'000'000LL,
52 10'000'000'000'000'000LL,
53 100'000'000'000'000'000LL,
54 1'000'000'000'000'000'000LL,
57constexpr long long pow10ll(
int x)
noexcept
60 return pow10_table[x];
63template<
typename Iterator>
64auto mean(Iterator first, Iterator last)
68 hilet sum = std::reduce(first, last, init);
74template<
typename Iterator,
typename T>
75auto stddev(Iterator first, Iterator last, T mean)
80 hilet tmp = value - mean;
81 return acc + tmp * tmp;
89constexpr void inplace_max(T& a, T
const& b)
noexcept
95constexpr void inplace_min(T& a, T
const& b)
noexcept
101constexpr void inplace_clamp(T& a, T
const& lo, T
const&
hi)
noexcept
104 a = std::clamp(a, lo,
hi);
108[[nodiscard]]
constexpr T abs(T a)
noexcept
110 return a < T{} ? -a : a;
113template<std::
floating_po
int T>
114[[nodiscard]]
constexpr bool almost_equal(T a, T b)
noexcept
117 return std::abs(a - b) <= e;
125template<std::
floating_po
int T>
128 return degree * (std::numbers::pi_v<T> / T{180.0});
136template<std::
unsigned_
integral T>
147template<std::
unsigned_
integral T>
Utilities to assert and bound check.
#define hi_axiom(expression)
Specify an axiom; an expression that is true.
Definition assert.hpp:133
Utilities used by the HikoGUI library itself.
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
DOXYGEN BUG.
Definition algorithm.hpp:15
constexpr T to_radian(T degree) noexcept
Convert degree to radian.
Definition math.hpp:126
The HikoGUI namespace.
Definition ascii.hpp:19
Definition alignment.hpp:75