I have some calculation in javascript that includes exponentiation.
Can any of you say why does this sentence return value 1???
alert ((0.03+1)^(271/365)-1);
Thanks
The ^
is actually a bitwise XOR operator . You're looking for Math.pow()
:
alert(Math.pow((0.03+1), (271/365))-1);
Math.pow( (0.03+1), ((271/365)-1) )
将得到0.9924164970995866
的结果
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.