频道直达 - 学院 - 下载 - 交易 - 特效 - 字库 - 手册 -排名-工具- 繁體
网页教学网站开发 设为首页
加入收藏
联系我们
建站搜索: 常用广告代码   用户注册 | 用户登陆
您当前的位置:中国建站之家 -> 网站开发设计技术教程 -> PHP教程 -> PHP4.04 增加了对无限精度运算的支持

PHP4.04 增加了对无限精度运算的支持

作者:佚名  来源:转载  发布时间:2005-7-18 17:41:43  发布人:acx

减小字体 增大字体

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 PHP with GMP support by using the --with-gmp option.
通过 GUN MP 库,这些函数允许你使用任意长度的整数。你需要编译 php 时使用 --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 PHP 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

<?php
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.


将本文收藏到QQ书签与更多好友分享
[打 印]
[] [返回上一页] [收 藏]
下一篇文章:PHP中的Java扩展
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
精彩推荐
热门文章
· 注册码大全二
· 注册码大全四
· 注册码大全一
· 要10G免费网络硬盘的请进..
· 通过google 赶快来赚美金..
· 注册码大全十
· 头像-qq头像(qq新头像)4..
· 让你轻松架设FTP服务器1..
· 注册码大全三
· 梦幻背景图片7
· 卡通动物图片6
· 网页制作素材-按钮素材2..
· 让你轻松架设FTP服务器5..
· 风景图片8
· 注册码大全九
· 让你轻松架设FTP服务器2..
关注此文读者还看过
· 好东西,老外用正则表达..
· 对Flash游戏初学者说的话..
· 用Photoshop绘制漂亮发饰..
· Photoshop上色秀
· 用好活动字幕标记—marq..
· 挑战最棒的留言本的源码..
· ASP错误代码
· FileCopy
· 提升PHP执行速度全攻略(..
· 禁止查看网页源代码全攻..
· PHP实现的功能是显示8条..
· 酷讯指谷歌生活搜索抄袭..
· 用PHP+MYSQL实现论坛里..
· Photoshop三步为照片添加..
· PHP3 入门教程(极短篇)..
· ASP.NET ViewState 初探..
相关文章
· PHP4和PHP5性能对比
· PHP使用者注意:PHP4.3.10以..
· PHP基础:PHP4和PHP5的配置..
· Windows下PHP4.0与Oracle 8..
· Apache2.0也能跑PHP3和PHP4..
· Win2000+Apache+MySql+PHP4..
· Apache2.0也能跑PHP3和PHP4..
· 如何集成Linux、Apache、PH..
· PHP4调用JavaBean的摸索(续..
· Windows 2000下安装PHP4及M..
· PHP4的新特性
· PHP4调用JavaBean的摸索
· Windows 98下安装Apache(PW..
· 深入了解php4(2)--重访过去..
· 深入了解php4(1)--回到未来..
· PHP4与MySQL数据库操作函数..
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 人才招聘
网站合作、内容监督、商务咨询:QQ: 9576619
Copyright ? 2005--2008 中国建站之家版权所有
粤ICP备05092265号