提高PHP的力量 [英] Raising to power in PHP
本文介绍了提高PHP的力量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
好吧,我需要在PHP脚本中进行一些计算.而且我有一个表现错误的表达方式.
Well, i need to do some calculations in PHP script. And i have one expression that behaves wrong.
echo 10^(-.01);
输出10
echo 1 / (10^(.01));
输出0
echo bcpow('10', '-0.01') . '<br/>';
输出1
echo bcdiv('1', bcpow('10', '0.01'));
输出1.000 ....
Outputs 1.000....
我正在使用bcscale(100)
进行BCMath计算.
I'm using bcscale(100)
for BCMath calculations.
Excel和Wolfram Mathematica给出了〜0,977237的答案.
Excel and Wolfram Mathematica give answer ~0,977237.
有什么建议吗?
推荐答案
插入符号是按位 XOR运算符在PHP中.您需要对整数使用 pow()
.
The caret is the bit-wise XOR operator in PHP. You need to use pow()
for integers.
这篇关于提高PHP的力量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文