I have reproducibly found that using gmpy2's pow function on its mpfr type returns 0 on any x value <= .5
>>> from gmpy2 import mpfr
>>> x = mpfr('.5')
>>> y = mpfr('2')
>>> print(pow(x, 2))
0.0 -> should be .25
>>> print(pow(y, 2))
4.0 -> correct
am I using the wrong function, or is there something that I am not getting here
You found a bug that was missed in the test suite. I recently added an optimization for mpfr(<<some small numbers>>) ** <<small Python integer>>. I have identified the cause and am validating the fix.
A work-around is to convert the exponent to an mpz first.
I have pushed out a new release. Please test version 2.1.0rc2. It can be installed with the command:
pip install gmpy2==2.1.0rc2