Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/boostorg/multiprecision
Browse files Browse the repository at this point in the history
…into cpp_double_fp_backend
  • Loading branch information
ckormanyos committed Jan 17, 2025
2 parents c6ce52d + 5e1db68 commit fc7f5ae
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions include/boost/multiprecision/detail/functions/pow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,27 @@ inline void pow_imp(T& result, const T& t, const U& p, const std::integral_const
return;
}

switch (p)
{
case 0:
result = int_type(1);
return;
case 1:
result = t;
return;
case 2:
eval_multiply(result, t, t);
return;
case 3:
eval_multiply(result, t, t);
eval_multiply(result, t);
return;
case 4:
eval_multiply(result, t, t);
eval_multiply(result, result);
return;
}

// This will store the result.
if (U(p % U(2)) != U(0))
{
Expand Down

0 comments on commit fc7f5ae

Please sign in to comment.