Given function:
y=power(x, z)
Where y is the base x raised to the power of z.
In Java and many other language, there is function Math.pow() to calculate this.
My question is: how to calculate x, given y and z? Is there a standard library function for this?
This is done easily enough by remembering a mathematical law:
And now because z*(1/z)=1, the inverse of raising to the power z is raising to the power 1/z. So in your case
Once you've got your power()
function, that's all you need.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.