Skip to content

arsinh of a large negative argument and Ci of a large complex one lose their value #2683

Description

@Rafael-SOWNet

On master (abd100a), two evaluations go wrong at large arguments. Reference values are from mpmath at 300 digits.

arsinh of a large negative argument

Positive arguments are right at every size tried. Negative ones lose about 2 * log10|x| of the 100 working digits, then return the logarithm of whatever the cancellation leaves.

.Evaled master true value
arsinh(10^200), arsinh(10^200 * i) 461.21016577936908… (+ 1.5707…i) same (correct)
arsinh(-10^30 - 1/3) -69.770699970381315829956975761989436129440544… -69.770699970381315829956975761989436129441878… (40 of 100 digits right)
arsinh(-10^49 - 1/3) -113.51981673726818… -113.51981673726818 (correct)
arsinh(-10^50 - 1/3) -1.0986122886681… + 3.1415926535897…i, which is ln(-1/3) -115.82240183026223
arsinh(-10^115 + 0.5) -0.6931471805599…, which is ln(1/2) -265.49043287487520
arsinh(-10^115) -265.49043287487519… same (correct)
arsinh(-10^116), arsinh(-10^200) -oo -267.79301796786924, -461.21016577936908
arsinh(-10^120 * i), arsinh(-10^200 * i) -oo -277.00335833984543 - 1.5707…i, -461.21016577936908 - 1.5707…i
arcsch(10^(-200) * i) -oo -461.21016577936908 - 1.5707…i

arsinh(x) evaluates as ln(x + sqrt(x^2 + 1)). For negative x the two terms cancel. arsinh is odd, so -arsinh(-x) would avoid the cancellation. That is unconfirmed.

Ci of a large complex argument

#2681 fixed Ci(10^60 + i). From 10^66 the imaginary part is dropped again, at 10^100 both parts are, and from about 10^120 the result is NaN.

.Evaled master true value
Ci(10^65 + i) -9.8598694349298E-66 + 9.0399897933229E-66i same (correct)
Ci(10^66 + i) -9.3193344373464E-67 -9.3193344373464E-67 + 9.3666728029509E-67i
Ci(10^80 + i) -8.7322816510786E-82 -8.7322816510786E-82 - 1.1733179410566E-80i
Ci(10^90 + i) -1.5350414397742E-90 -1.5350414397742E-90 + 1.1980441014016E-91i
Ci(10^100 + i) 0 -5.7460638528928E-101 - 1.0906829626430E-100i
Ci(10^120 + i), Ci(10^200 + i) NaN -9.6168031986450E-121 + 9.1906108290194E-121i, 1.4955097442547E-200 - 2.8955450281578E-201i

At 10^80 the dropped imaginary part is 13 times the real part that is kept. Si keeps its imaginary part at the same arguments: Si(10^80 + i) is 1.5707963267949 - 6.6504546736212E-82i, which is right.

cos(10^84 + i) is NaN, while cos(10^83 + i) and the real cos(10^200) have values. That is the cut-off for an inexact argument past 10^(precision - 16), from #2674, and a complex argument is never exact. It may be why Ci gives NaN from 10^120, but Ci has values between 10^85 and 10^100, so it does not account for everything.

Found while checking #2681's probe values against mpmath.

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