php乘法有bug?解决办法

WBOY
Release: 2016-06-13 10:18:04
Original
1043 people have browsed it

php乘法有bug?
85112854 * 4294967296 + 384440042 
计算结果用sprintf("%.0f"输出是365556924783662848,而用计算器计算得到的结果是365556924783662826
被这个问题搞的头大死了。。
有谁知道是什么原因吗?

------解决方案--------------------
这样运算,或用gmp函数

PHP code
echo    bcadd(bcmul(85112854, 4294967296), 384440042);<br><font color="#e78608">------解决方案--------------------</font><br>echo bcadd(bcmul('85112854', '4294967296', 0), '384440042', 0);//365556924783662826<br><div class="clear">
                 
              
              
        
            </div>
Copy after login
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template