Skip to content

Hang in hyperbolic cosine integral function with NaN input #482

Description

@jacksonvanover

mpmath version: 1.1.0

When the argument to the floating-point precision version of the hyperbolic cosine integral function is a NaN, a hang is
caused. The mp version returns NaN.

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.chi(np.nan)
mpf('nan')
>>> fp.chi(np.nan)
^CTraceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/ctx_fp.py", line 57, in f_wrapped
    return f(ctx, *args, **kwargs)
  File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/functions/expintegrals.py", line 387, in chi
    v = 0.5*(ctx.ei(z) + ctx.ei(nz))
  File "/home/jvanover/.local/lib/python3.6/site-packages/mpmath/functions/expintegrals.py", line 290, in ei
    return ctx._ei(z)
  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 510, in ei_asymp
    if abs(t) < 1e-16:
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