简体   繁体   English

javascript取词中的数学函数

[英]math function in javascript exponentiation

I have some calculation in javascript that includes exponentiation. 我在javascript中有一些包含取幂的计算。

Can any of you say why does this sentence return value 1??? 你们有谁能说这句话为什么会返回值1 ???

        alert ((0.03+1)^(271/365)-1);

Thanks 谢谢

The ^ is actually a bitwise XOR operator . ^实际上是一个按位XOR运算符 You're looking for Math.pow() : 您正在寻找Math.pow()

alert(Math.pow((0.03+1), (271/365))-1);

Math.pow( (0.03+1), ((271/365)-1) )将得到0.9924164970995866的结果

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM