0

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

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

from gmpy2 import mpfr

mpfr(0.5)

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

from gmpy2 import mpfr

mpfr(0.25)

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

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

4

1 回答 1

1

I'm the maintainer of gmpy2 and those examples should work. I'm guessing there is an incompatibility between the CPU instruction set I chose when I compiled gmpy2 and your computer.

Can you open an issue report at https://code.google.com/p/gmpy/issues/list ?

Please include detailed system information.

Once we find the cause of the issue, I'll update this answer.

Update

I think I identified the cause and a new version is available at PyPI. I cannot reproduce the issue so I can't be sure it has been fixed.

于 2014-07-19T19:19:59.580 回答