问题标签 [mpfr]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
330 浏览

python - mpfr(0.5) 无效的浮点运算

我希望我没有指出一些明显的东西,或者对此的修复并不明显。

我在 64 位 windows 7 机器上使用 gmpy2 2.0.3,使用 PyScripter 编码。以下代码给出“无效的浮点运算”错误,

这在别人身上发生过吗?我知道 0.5 = 0*1 + 1/2^(1),如果这能激发任何灵感的话。同样,这也打破了,

因为 0.25 = 0*1 + 0*(1/2^1) + 1*(1/2^2)。

编辑:我是这个包的新手,也许有一些关于如何正确使用的想法。如果这个问题在适当的论坛中没有,请原谅。

0 投票
3 回答
911 浏览

python - MPFR 除法比本机整数除法快吗?

我一直假设整数除法比浮点除法更快,但我做了一些似乎证明并非如此的测试。

整数除法耗时 0.17 秒,mpfr 除法耗时 0.06 秒,两个浮点数相除耗时 15.56 秒。

我的问题:

  1. 我是否正确设置了此测试?
  2. mpfr除法真的比native除法更优化吗?
  3. 涉及浮点数和整数的除法是否比涉及两个浮点数的除法快得多?
0 投票
2 回答
27900 浏览

linux - 在 Red Hat Enterprise linux 6.5 上安装 GCC 4.8.2

我是红帽企业 Linux 的新手。我在 Red Hat Enterprise Linux 6.5 上编译 gcc 4.8.2 时遇到问题,我下载了 GNU 网站的源代码。我遵循此链接 http://gcc.gnu.org/wiki/InstallingGCC中的步骤 触发的命令是:

我在 Google 上进行了调查,然后我发现以下与此 http://gcc.gnu.org/ml/gcc-help/2012-02/msg00142.html相关的问题, 但它再次将我重定向到我之前找到并遵循的上述链接。

我需要有关如何处理此问题的指导。欢迎提出建议。

0 投票
1 回答
145 浏览

c - There is a real reason for gcc to be so conservative with its dependecies ? ( MPFR, GMP, MPC )

I'm wondering if someone knows why gcc tends to be so conservative about the versions of the libraries to use to compile and build gcc itself .

The main reasons why I'm asking this are :

  1. I think that there is a big shift between the "implicitly suggested" versions listed here ( they also appear named in some scripts inside the gcc sources ) and the latest milestones available
  2. I think that at some point being that conservative can only increase the chances of carrying bugged and sub-optimal versions of the given library

latest releases available at the moment vs the "implicitly suggested" ones :

This is just for the vital ones, there are also others like cloog and isl, but here you can see a big difference, those releases are just old .

Does anyone happens to know about some good reasons to do that ? Breaking changes in this 3 libraries ? Stability ? Portability ?

0 投票
0 回答
731 浏览

c++ - MPFR 库:如何添加两个 mprf_t 变量并打印结果?

我正在寻找一些说明mpfr图书馆的例子,但我找不到任何有用的东西。

我想创建两个最多可以容纳 100 位浮点数的变量。

这些变量必须使用字符串进行初始化。

然后我想添加它们并将结果打印到屏幕上。

我找到了这段代码:

然后我尝试了以下代码:

结果

Sum is 1.5913548686908708384990518425183836370706558227539062500000000e1

这是错误的,它应该至少是 2

0 投票
1 回答
531 浏览

python - python bigfloat安装问题

我的问题与这张海报类似,我使用的是 MAC OsX 10.9.5 版本:

python 'bigfloat' 包安装问题

当我尝试安装“mpc-1.0.2”包时,它无法编译并给出以下错误:

我的配置命令是:

./configure --prefix=/users/username/local --with-gmp=/users/username/local --with-mpfr=/users/username/local

任何人或 Casevh 都可以帮忙吗?

0 投票
1 回答
597 浏览

gmp - MPFR:得到 mpf_class 的罪过

我在我的环境中安装了 gmp 和 mpfr。现在我可以成功

现在,假设我用一些值初始化了一个 mpf_class:

我怎样才能使用 mpfr 来获得这个数字的罪孽?我只需要一个 mpf_class 输入,一个 mpf_class 输出。就像是:

这显然行不通。我注意到有一个 mpfr_sin 函数,我这样称呼它:

但这也没有奏效。那我该怎么办?难道我做错了什么?

谢谢

0 投票
1 回答
687 浏览

r - 使用 Rmpfr 在 R 中精确舍入

我正在尝试使用Rmpfr带有round()函数的库来将半数应用于偶数规则并获得正确的结果,而不会由于浮点值的有限精度而出现错误,如此处所述

到目前为止,这是我所取得的成就:

但在某些情况下,我没有得到想要的结果:

阅读Rmpfr文档,在roundMpfr()函数中,它说:

mpfr 类组方法 Math2 实现了一个用于舍入到十进制数字的 round(x, digits) 方法。

但我不知道如何使用它。

如何使用 获得所需的回合结果Rmpfr

0 投票
2 回答
263 浏览

c - mpfr_t 函数声明错误

我正在尝试创建一个返回类型 mpfr_t 的函数,但在其声明中出现错误。头文件声明看起来像(mpfr.h 是本地的):

但是当我尝试编译时,出现以下错误:

有任何想法吗?

0 投票
1 回答
489 浏览

c++ - zkcm-library 没有找到 mpfr-library

我刚刚在我的 kubuntu 机器上安装了zkcm 库,但在编译 c++ 代码时遇到了问题。

我已经安装了gmpandmpfr库并检查了它们是否工作;编码

编译并运行。

然后我尝试使用zkcm;我尝试编译该行

并得到一堆似乎关于zkcm找不到的错误mpfr;这是输出的开头:

我已尝试按照 infrom 中的说明进行操作zkcm;我有线条

我编译代码(称为test.cpp)使用

有任何想法吗?