diff --git a/include/eve/module/math/regular/impl/pow1p.hpp b/include/eve/module/math/regular/impl/pow1p.hpp index 254e3f3ad1..6c8dfee039 100644 --- a/include/eve/module/math/regular/impl/pow1p.hpp +++ b/include/eve/module/math/regular/impl/pow1p.hpp @@ -13,12 +13,15 @@ namespace eve::detail { -template +template auto pow1p_(EVE_SUPPORTS(cpu_), T const& a, U const& b) noexcept -> decltype(pow(a, b)) { - return arithmetic_call(pow1p, a, b); + if constexpr(integral_value) + return pow(dec(a), b); + else + return arithmetic_call(pow1p, a, b); } template diff --git a/include/eve/module/math/regular/impl/powm1.hpp b/include/eve/module/math/regular/impl/powm1.hpp index fd89e7dd0c..135fd79d24 100644 --- a/include/eve/module/math/regular/impl/powm1.hpp +++ b/include/eve/module/math/regular/impl/powm1.hpp @@ -13,15 +13,18 @@ namespace eve::detail { -template +template auto powm1_(EVE_SUPPORTS(cpu_), T const& a, U const& b) noexcept -> decltype(pow(a, b)) { - return arithmetic_call(powm1, a, b); + if constexpr(integral_value) + return dec(pow(a, b)); + else + return arithmetic_call(powm1, a, b); } -template +template auto powm1_(EVE_SUPPORTS(cpu_), T const& x, T const& y) noexcept { diff --git a/test/unit/module/math/pow1p.cpp b/test/unit/module/math/pow1p.cpp index 2669138458..86af7458cf 100644 --- a/test/unit/module/math/pow1p.cpp +++ b/test/unit/module/math/pow1p.cpp @@ -24,6 +24,8 @@ TTS_CASE_TPL("Check return types of pow1p", eve::test::simd::ieee_reals) TTS_EXPR_IS(eve::pow1p(v_t(), v_t()), v_t); TTS_EXPR_IS(eve::pow1p(T(), v_t()), T); TTS_EXPR_IS(eve::pow1p(v_t(), T()), T); + TTS_EXPR_IS(eve::pow1p(v_t(), int()), v_t); + TTS_EXPR_IS(eve::pow1p(T(), int()), T); }; //================================================================================================== diff --git a/test/unit/module/math/powm1.cpp b/test/unit/module/math/powm1.cpp index adeb6dd5de..e43b6d59a1 100644 --- a/test/unit/module/math/powm1.cpp +++ b/test/unit/module/math/powm1.cpp @@ -23,7 +23,8 @@ TTS_CASE_TPL("Check return types of powm1", eve::test::simd::ieee_reals) TTS_EXPR_IS(eve::powm1(T(), T()), T); TTS_EXPR_IS(eve::powm1(v_t(), v_t()), v_t); TTS_EXPR_IS(eve::powm1(T(), v_t()), T); -}; + TTS_EXPR_IS(eve::powm1(v_t(), int()), v_t); + TTS_EXPR_IS(eve::powm1(T(), int()), T);}; //================================================================================================== // powm1 tests