帝国软件
  设为首页 加入收藏 关于我们
 
解密帝国网站管理系统
栏 目:
 
您的位置:首页 > 技术文档 > PHP编程
PHP4.04 增加了对无限精度运算的支持
作者:匿名 发布时间:2003-01-27 来源:动网先锋
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.

  
评论】【加入收藏夹】【 】【打印】【关闭
※ 相关链接
 ·Windows 98下安装Apache(PWS) PH  (2005-03-12)
 ·RedHat上安装 apache + gd1.8.3   (2005-03-11)
 ·PHP4.04在英文win2000下的安装  (2005-03-11)
 ·PHP4.03在linux下的安装  (2005-03-11)
 ·PHP4.04在win98下的安装  (2005-03-11)
 ·PHP4.23在WindowsXP下的IIS和Apa  (2005-03-11)
 ·apache2.0.39 php4.2.3在windows  (2005-03-11)
 ·PHP4(windows版本)中的COM函数  (2005-03-11)
 ·让你的PHP4和PHP5共存...  (2005-03-11)
 ·在Windows中安装Apache2和PHP4的  (2005-03-11)

   栏目导行
  PHP编程
  ASP编程
  ASP.NET编程
  JAVA编程
   站点最新
·致合作伙伴的欢迎信
·媒体报道
·帝国软件合作伙伴计划协议
·DiscuzX2.5会员整合通行证发布
·帝国CMS 7.0版本功能建议收集
·帝国网站管理系统2012年授权购买说
·PHPWind8.7会员整合通行证发布
·[官方插件]帝国CMS-访问统计插件
·[官方插件]帝国CMS-sitemap插件
·[官方插件]帝国CMS内容页评论AJAX分
   类别最新
·Windows下集成安装Apache,PHP,MYSQ
·Mysql注入:SQL Injection with MyS
·PHP 的来龙去脉
·PHP 的功能概述
·PHP与其它CGI的比较
·PHP 的编译配置详细选项
·php.ini 配置详细选项
·如何写作PHP程序
·Hello,World
·嵌入方法
 
关于帝国 | 广告服务 | 联系我们 | 程序开发 | 网站地图 | 留言板 帝国网站管理系统