diff --git a/include/eve/module/core/regular/impl/average.hpp b/include/eve/module/core/regular/impl/average.hpp index 6a7ac6a48c..663c45e370 100644 --- a/include/eve/module/core/regular/impl/average.hpp +++ b/include/eve/module/core/regular/impl/average.hpp @@ -41,8 +41,14 @@ average_(EVE_SUPPORTS(cpu_), T const& a, T const& b) noexcept { if constexpr(has_native_abi_v) { - if constexpr( integral_value ) return (a & b) + ((a ^ b) >> 1); //compute ceil( (x+y)/2 ) - else return fma(a, half(eve::as(a)), b * half(eve::as(a))); + if constexpr( integral_value ) + return (a & b) + ((a ^ b) >> 1); //compute ceil( (x+y)/2 ) + else + { + using u_t = underlying_type_t; + const auto h = eve::half(eve::as()); + return fma(a, h, b * h); + } } else return apply_over(average, a, b); }