Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Error in tanh for large complex argument (Trac #1726) #2321

@numpy-gitbot

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/1726 on 2011-01-28 by trac user mbakker, assigned to unknown.

tanh computes nans for large complex argument:

In [85]: tanh(1000+0j)
Out[85]: (nan+nan*j)

while the correct answer is 1.0

Solution: Program tanh as:

tanh(z) = (1.0 - exp(-2.0_z)) / (1.0 + exp(-2.0_z))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions