ginac库任意精度运算
作者:
一路向后 | 来源:发表于
2020-10-13 21:28 被阅读0次1.程序源码
#include <iostream>
#include <ginac/ginac.h>
using namespace std;
using namespace GiNaC;
int main()
{
//定义分数
numeric a = 3;
numeric b = 0;
//修改精度
Digits = 100;
b = sqrt(a);
//打印输出结果
cout << b.evalf() << endl;
return 0;
}
2.编译源码
$ g++ -o example example.c -lginac -lcln -I/usr/local/include -L/usr/local/lib64
3.运行结果
./example
1.7320508075688772935274463415058723669428052538103806280558069794519330169088000370811461867572485756756261414154067
本文标题:ginac库任意精度运算
本文链接:https://www.haomeiwen.com/subject/sxebpktx.html
网友评论