Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a specialization of
ipow
for signed integers.
The original signature of `ipow` only accepted an unsigned integer as exponent. However, it seems that it was called using integers as exponents. Thus there is now a specialization for this case. For the sake of argument let's consider the following situation `ipow(a, b)`: - If `b` was zero then the previous implementation would return `a`, the new implementation returns 1. - If `b` was negative then it would perform a lot of iterations, because a signed integer was converted to an unsigned one. In the new implementation, the function would return 0, which is in agreement with what `pow` does.
- Loading branch information