<?php
$sum = gmp_add("123456789012345", "76543210987655");
echo gmp_strval($sum) . "\n";
?> 当然是能用任意长度整数的,GMP Functions
还有BcMath库用与任意精度数学的bcadd()函数当然还是看下手册。
记的不是很清楚,不好意思。
$sum = gmp_add("123456789012345", "76543210987655");
echo gmp_strval($sum) . "\n";
?> 当然是能用任意长度整数的,GMP Functions
还有BcMath库用与任意精度数学的bcadd()函数当然还是看下手册。
记的不是很清楚,不好意思。
解决方案 »
- phpmyadmin的#1045 - Access denied for user 'root'@'localhost' (using password: NO
- (散分)刚毕业工资4500(税前),大家说一下你们的工资怎么样
- 请教php实时显示数据执行过程
- php 判断远程文件是否存在
- 新手提问:关于file函数
- 大家请看看我这个奇怪的SQL语句
- 这样的字符分隔如何处理!
- 请问为什么我读写文件老是出错呢?
- 为什么错?在线等待给分
- PHPexcel导入excel内容到数据库出错, $objPHPExcel=$objReader->load()报错,php编程
- 小问题求教
- Warning: Cannot use a scalar value as an array in D:\httpd\HTDOCS\xiaohong\cart.php on line 32
echo $sum . "\n";
介绍
For arbitrary precision mathematics PHP offers the Binary Calculator which supports numbers of any size and precision, represented as strings. 需求
Since PHP 4.0.4, libbcmath is bundled with PHP. You don't need any external libraries for this extension.
$a = 1073741824;
$b = 2147483648;var_dump(decbin($a)); //string(31) "1000000000000000000000000000000"
var_dump(decbin($b)); //string(32) "10000000000000000000000000000000"
var_dump(decbin($a | $b)); //string(32) "11000000000000000000000000000000" ?>