开源数学运算库 GMP

GMP(开源数学运算库)【开源数学运算库 GMP】GMP,是GNU MP Bignum Library的缩写,意思是开源数学运算库 。
基本介绍中文名:开源数学运算库
外文名:GNU MP Bignum Library
GMP是The GNU MP Bignum Library,是一个开源的数学运算库,它可以用于任意精度的数学运算,包括有符号整数、有理数和浮点数 。它本身并没有精度限制,只取决于机器的硬体情况 。GMP is a free library for arbitrary precision arithmetic, operating on signed integers, rational numbers, and floating point numbers. There is no practical limit to the precision except the ones implied by the available memory in the machine GMP runs on. GMP has a rich set of functions, and the functions have a regular interface.The main target applications for GMP are cryptography applications and research, Internet security applications, algebra systems, computational algebra research, etc.GMP is carefully designed to be as fast as possible, both for small operands and for huge operands. The speed is achieved by using fullwords as the basic arithmetic type, by using fast algorithms, with highly optimized assembly code for the most common inner loops for a lot of CPUs, and by a general emphasis on speed.GMP is faster than any other bignum library. The advantage for GMP increases with the operand sizes for many operations, since GMP uses asymptotically faster algorithms.The first GMP release was made in 1991. It is continually developed and maintained, with a new release about once a year.GMP is distributed under the GNU LGPL. This license makes the library free to use, share, and improve, and allows you to pass on the result. The license gives freedoms, but also sets firm restrictions on the use with non-free programs.GMP is part of the GNU project. For more information about the GNU project, please see the official GNU web site.GMP is brought to you by a team listed in the manual.用法举例:(GMP在PHP中的用法,用GMP库计算阶乘)<?phpfunction fact($x){$return = 1;for ($i=2; $i < $x; $i++) {$return = gmp_mul($return, $i);}return $return;}echo wordwrap(gmp_strval(fact(1000)), 75, "\n", true) . "\n"; // 为了排版方便,我们採用了断行?> 。