Skip to content

arcsin, arccos, tanh and Ci lose or invent a part of the answer past about 1e50 #2675

Description

@Rafael-SOWNet

On master (4674e66), evaluating an inverse or hyperbolic function at an argument past about 10^50 drops a part of the answer, or invents one. Reference values are from mpmath at 700 digits.

.Evaled master true value
arcsin(10^60) 1.5707… - 138.848…i same (correct)
arcsin(10^100) 1.5707… 1.5707… - 230.9517i
arcsin(10^200), arcsin(10^500) 0 1.5707… - 461.2102i, 1.5707… - 1151.9857i
arccos(10^500) 1.5707… 1151.9857i
tanh(10^40 * i) 0.69307i same (correct)
tanh(10^60 * i) -2.2211 - 1.4903i -1.4903i (real part 0)
Ci(10^20) -6.4525E-21 same (correct)
Ci(10^50) 0 -7.8967E-51

The likely cause is that the complex paths treat any part below about 10^-50 times the size of the argument as zero. At a large argument this keeps rounding noise as a real part, as in tanh(10^60 i), and throws away an imaginary part the answer needs, as in arcsin. Ci drops its whole value the same way once that value is below that relative scale.

Found while checking #2668's fix (#2674), which keeps master's answers past 10^1000 the same and does not reach this range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions