Reputation: 45
I hope I am not pointing out something obvious, or that the fix to this is not obvious.
I am using gmpy2 2.0.3 on a 64 bit windows 7 machine, coding with PyScripter. The following code gives an "Invalid floating point operation" error,
from gmpy2 import mpfr
mpfr(0.5)
Does this happen to anyone else? I understand that 0.5 = 0*1 + 1/2^(1), if that should inspire anything. Similarly, this also breaks,
from gmpy2 import mpfr
mpfr(0.25)
since 0.25 = 0*1 + 0*(1/2^1) + 1*(1/2^2).
Edit: I am new to the package, maybe some ideas on how to use if properly. Please pardon this if this question is no in the appropriate forum.
Upvotes: 0
Views: 342
Reputation: 11404
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.
Upvotes: 1