开发者

PHP: power bug - 10^(1/4) == 10?

Why 10^(1/4) is 10? which function should I use to obtain correct result?

My test line is:

 echo (10^(100/400)). " vs " . 10;

开发者_JS百科and my output is

10 vs 10

EDIT:

thanks for answers, I will use pow()


^ is the XOR bitwise operator. Use pow(10, 1/4) (docs) instead.


Pretend you're a cartoon superhero with POW!

echo pow(10, 1/4);


After a quick google search: http://php.net/manual/en/function.pow.php

Use pow(10, 1/4)

I think the ^ is some kind of binary operation, which is not what you want.


What you are actually calculating there is 10, xor (100 integer divided by 400), which is 10 xor 0, which is 10.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜