dedecms织梦内容管理系统    
首页 | java | C/C++ | PHP | 操作系统 | ajax | 脚本编程 | 安全技术 | 本站下载页 | flex | CRM | 专题 | QQ群 | 测试中心 | 会员中心 | 积分规则
  当前位置:主页>PHP>php技术资料>文章内容
PHP4.04 增加了对无限精度运算的支持
来源:未知     作者:    
These functions allow you to work with arbitrary-length integers using the GNU MP library. In order to have these functions available, you must compile with GMP support by using the --with-gmp option.
通过 GUN MP 库,这些允许你使用任意长度的整数。你需要编译 时使用 --with-gmp 参数

You can download the GMP library from http://www.swox.com/gmp/. This site also has the GMP manual available.
你可以从 http://www.swox.com/gmp/ 下载 GMP 库,同时有手册。

You will need GMP version 2 or better to use these functions. Some functions may require more recent version of the GMP library.
你需要 GMP 2.0 或更好的来使用这些函数。某些可能需要最新的 GMP库

These functions have been added in 4.0.4.

Note: Most GMP functions accept GMP number arguments, defined as resource below. However, most of these functions will also accept numeric and string arguments, given that it is possible to convert the latter to a number. Also, if there is a faster function that can operate on integer arguments, it would be used instead of the slower function when the supplied arguments are integers. This is done transparently, so the bottom line is that you can use integers in every function that expects GMP number. See also the gmp_init() function.
注意:大多数 GMP 函数接受下面资源定义的 GMP 数值参数,当然,大多数函数也接受数字和字符串参数,但是会被转化为数字。同时,如果存在更快的函数来操作整形参数,则会使用那个更快的来操作整数。这是当然的,所以你可以在需要 GMP 数字的地方用整数参数。

Example 1. Factorial function using GMP

<?
function fact ($x) {
if ($x <= 1)
return 1;
else
return gmp_mul ($x, fact ($x-1));
}

print gmp_strval (fact (1000)) . "n";
?>

This will calculate factiorial of 1000 (pretty big number) very fast.

 

 

上一篇:PHP中的Java扩展   下一篇:PHP4.04 新增加了专用的字符函数 Ctype
[收藏] [推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
用户名: 新注册) 密码: 匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论
  热点文章
·通过对PHP服务器端特性的配置加
·php与mysql三日通
·AJAX技术在PHP开发中的简单应用
·大家所使用的PHP开发环境
·PHP缓存的实现
·针对PHP新手总结的PHP基础知识
·一个简单实现多条件查询的例子
·PHP串行化变量和序列化对象
·PHP表单
·推荐阅读:php技术生成静态页面
·php实用函数
·php生成随机数
  相关文章
·PHP中的Java扩展
·PHP4.04 新增加了专用的字符函数
·PHP中如何在输出内容后再输出头
·php4的彩蛋
·RPM安装PHP后应如何配置 Apache
·正则表达式例子:获得某个网页上
·PHP中创建并处理图象
·正则表达式例子:在一个字符串中
·学习使用PHP数组
·正则表达式例子:将MM/DD/YYYY格
·如何正确理解PHP的错误信息
·Pattern Modifiers - 规则表达式
  相关信息
copy right @ 百家拳软件项目研究室 2007 辽ICP备07011763