Skip to content

Hang in exponential integral function with NaN input #487

Description

@jacksonvanover

mpmath version: 1.1.0

When using the fp context, if the argument to the exponential integral is a NaN, a hang is
caused. The mp context returns a complex number.

Example:

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.e1(np.nan)
mpc(real='nan', imag='-3.1415926535897931')
>>> fp.e1(np.nan)
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/functions/expintegrals.py", line 325, in e1
    return ctx._e1(z)
  File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/math2.py", line 602, in e1
    return -ei(-z, _e1=True)
  File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/math2.py", line 574, in ei
    ref = ei_asymp(zref, _e1)
  File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/math2.py", line 512, in ei_asymp
    k += 1
KeyboardInterrupt

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions