Skip to content

limit of rgamma function in fp context #510

@jacksonvanover

Description

@jacksonvanover

mpmath version: 1.1.0

mp.rgamma(inf) evaluates to 0, but fp.rgamma(inf) throws the exception cannot convert float infinity to integer. I mention this as a potential issue because I've observed that in other cases, limits at infinity are handled in both namespaces, eg with the altzeta function or the gammainc function.

Python 3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mpmath import *
>>> import numpy as np
>>> mp.rgamma(np.inf)
mpf('0.0')
>>> fp.rgamma(np.inf)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/mpmath/math2.py", line 235, in rgamma
    return 1./gamma(x)
  File "/usr/local/lib/python3.6/dist-packages/mpmath/math2.py", line 30, in f
    return f_real(x)
  File "/usr/local/lib/python3.6/dist-packages/mpmath/math2.py", line 199, in _gamma_real
    _intx = int(x)
OverflowError: cannot convert float infinity to integer
>>> mp.altzeta(np.inf) 
mpf('1.0')
>>> fp.altzeta(np.inf)
1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions