[英]Math power doesn't work correctly in formula in php
I am trying to add this formula into my PHP script: 我正在尝试将此公式添加到我的PHP脚本中:
50x^(y−10)
In this example: x = 1.1
and y = 99
which makes the formula: 在此示例中:
x = 1.1
和y = 99
,从而得出公式:
50*1.1^(99-10)
This should return ~241501.0278
as result. 结果应返回
~241501.0278
。 But when I apply this in PHP, I only get 110
as output. 但是当我在PHP中应用它时,我只能得到
110
。
$vocMultiplier = 1.1;
$startSkill = 99;
$amountOfHits = 50 * $vocMultiplier ^($startSkill - 10);
echo $amountOfHits;
What am I doing wrong here? 我在这里做错了什么?
You are mis-interpreting the ^
symbol for the pow
function. 您误解了
pow
函数的^
符号。
http://php.net/manual/en/function.pow.php http://php.net/manual/en/function.pow.php
^
is the Bitwise Exclusive Or operator. ^
是按位异或运算符。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.