Skip to content

log and log1p return incorrect results at complex infinities #774

Description

@pearu

As in the title.

Reproducer:

>>> mpmath.log(mpmath.inf + 1j * mpmath.inf)  # expecting (+∞,π/4)
mpc(real='nan', imag='1.5707963267948966')
>>> mpmath.log(mpmath.inf - 1j * mpmath.inf)  # expecting (+∞,-π/4)
mpc(real='nan', imag='-1.5707963267948966')
>>> mpmath.log(-mpmath.inf + 1j * mpmath.inf)  # expecting (+∞,3π/4)
mpc(real='nan', imag='1.5707963267948966')
>>> mpmath.log(-mpmath.inf - 1j * mpmath.inf)  # expecting (+∞,-3π/4)  # corrected
mpc(real='nan', imag='-1.5707963267948966')

The expected values are defined in https://en.cppreference.com/w/cpp/numeric/complex/log as special values to complex log function.

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