开发者

What's the opposite of JavaScript's Math.pow?

开发者 https://www.devze.com 2023-01-22 09:09 出处:网络
I\'m having a mental block here, and algebra not really being my开发者_运维知识库 thing, can you tell me how to re-write the JavaScript code below to derive the variable, c, in terms of a and b?:

I'm having a mental block here, and algebra not really being my开发者_运维知识库 thing, can you tell me how to re-write the JavaScript code below to derive the variable, c, in terms of a and b?:

a = Math.pow(b, c);
c = ?

Thanks!


c = Math.log(a)/Math.log(b)


Logarithms. You want the logarithm of a. B is the base, c is the exponent, so

logb a = c

0

精彩评论

暂无评论...
验证码 换一张
取 消