5 #ifndef DUNE_COMMON_STD_CMATH_HH 6 #define DUNE_COMMON_STD_CMATH_HH 10 #if __has_include(<version>) 12 #if (__cpp_lib_constexpr_cmath < 202306L) 14 #include <type_traits> 23 #if (__cpp_lib_constexpr_cmath < 202202L) 29 if (std::is_constant_evaluated()) {
30 return (t < 0) ? -t : t;
40 requires(std::is_floating_point_v<T> || std::is_integral_v<T>)
42 if (std::is_constant_evaluated()) {
43 using TT = std::conditional_t<std::is_floating_point_v<T>, T,
double>;
44 if (t >= TT{ 0 } and t < std::numeric_limits<TT>::infinity()) {
47 TT curr = t, prev = 0;
49 prev = std::exchange(curr, TT{ 0.5 } * (curr + TT{ t } / curr));
52 return std::numeric_limits<TT>::quiet_NaN();
68 #endif // #ifndef DUNE_COMMON_STD_CMATH_HH requires(((std::is_integral_v< I > or Dune::IsIntegralConstant< I >::value) &&...)) HybridMultiIndex(I... i) -> HybridMultiIndex< decltype(Impl::castToHybridSizeT(i))... >
Dune namespace
Definition: alignedallocator.hh:12
constexpr auto sqrt(T t) requires(std
Definition: cmath.hh:39
constexpr T abs(T t)
Definition: cmath.hh:27