使用MPFR总结

来源:互联网 发布:江西省软件行业办 编辑:程序博客网 时间:2024/05/30 22:43

由于项目中需要用到大数值相关的运算,所以选择使用MPFR,以下为一些使用总结。


安装过程  

安装环境为Centos

相关下载路径:

GMP:https://gmplib.org/download/gmp/gmp-6.1.0.tar.bz2

MPFR:http://www.mpfr.org/mpfr-current/mpfr-3.1.3.tar.gz


1,安装GMP

tar jxvf gmp-6.1.0.tar.bz2

cd gmp-6.1.0/

./configure

make

make check(注意查看有没有error)

make install



2,安装MPFR

tar zxvf mpfr-3.1.3.tar.gz

cd mpfr-3.1.3

./configure --with-gmp-include=/usr/local/include --with-gmp-lib=/usr/local/lib (如果上面GMP的为默认安装路径的话)

make

make check(注意查看有没有error)

make install


如何使用

在代码中 #include <mpfr.h> 

编译时增加 -lmpfr -lgmp


待续。。。。



相关网站 

https://gmplib.org/

http://www.mpfr.org/ 

0 0
原创粉丝点击