how to compute power of negative number like 10^-1 or 10^-3
Negative powers pretty much always give fractional results, which means you must use floats. For floats, there is powf
and powi
. Note that a^(-b) = 1 / a^b
.
3 Likes
Just a side note on terminology:
Doesn't the title suggest that a < 0
in a ^ b
?
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.