Skip to content

Keep every part of a complex value past 10^50 (#2675) - #2676

Merged
Rafael-SOWNet merged 1 commit into
masterfrom
fix-2675-large-argument-complex-parts
Dec 1, 2026
Merged

Rafael-SOWNet merged 1 commit into
masterfrom
fix-2675-large-argument-complex-parts

Conversation

@Rafael-SOWNet

Copy link
Copy Markdown
Member

Fixes #2675

What was wrong

On master (4674e66), past an argument of about 10^50 the complex paths dropped a part of the answer or kept noise as one: arcsin(10^100) was 1.5707… where it is 1.5707… - 230.95i, arcsin(10^200) and arcsin(10^500) were 0, arccos(10^500) was 1.5707… where it is 1151.99i, tanh(10^60 i) was -2.2211 - 1.4903i where it is -1.4903i, and Ci(10^50) was 0 where it is -7.8967E-51.

The cause

Two things, both confirmed by measurement.

  1. A sine or cosine treated as a residual of its argument's size. Complex.Create (Entity.Continuous.Complex.Definition.cs:141) drops an imaginary part below DowncastingTolerance × imaginaryScale, which is 1e-50 × the scale at 100 digits. The complex paths passed |t|, the size of the sine's argument, as that scale: Exp (Operators.cs:576 on master, scale = expReal × |imaginary|), Sin and Cos (reScale = |re|), Tan (|2 re| / |D|), Cotan, and EiByTheAsymptoticSeries (ExponentialIntegrals.cs:194, trigonometric = |im| (|re| + |im|)). A sine is at most 1, so once |t| passes 10^50 every sine and cosine is under the threshold. So e^(10^60 i) kept only cos(10^60), and tanh(10^60 i) = (e^(2·10^60 i) - 1)/(e^(2·10^60 i) + 1) came out with a real part. Ci(10^50) is sin x/x, about 1e-50, measured against about 1, so it was dropped too.
  2. arcsin/arccos took their real part from beta = (rho - sigma)/2 (ArcSinCosInner, Operators.cs:1216 on master). That is a difference of two moduli the size of the argument, so past 10^110 (the working digits) it cancels completely: beta = 0, and arcsin(10^200) = 0. Both parts were also made against scale = alpha × 10^-10 (ArcSinOrCos, Operators.cs:1294), so the imaginary part 230.95 was dropped against alpha = 10^100.

sqrt(10^50 + i) hit a third path. FindGoodRoot scaled the base to 1 + 10^-50 i. GetAllRoots then rounded the root's phase, 5e-51, onto 0, so the search returned the real root 10^25.

The fix

  • PeriodicResidualScale(t, exact) is the size a sine or cosine residual is measured against:

    • |t| up to 1, unchanged;
    • sqrt|t| past 1 for a decimal, i.e. half the digits its reduction by 2π leaves, matching the library's half-digit convention;
    • 1 for an exact rational.

    Exp, Sin, Cos, Tan, Cotan, ByThePolarForm, Complex.CreatePolar and the asymptotic series of Ei use it.

  • An exact rational argument is now reduced exactly on the complex paths too (SinAndCosOfAReal, from Keep evaluation's digits from 1e-100000 to 1e100000 #2674). The same goes in Ei, Si, Ci, Shi and Chi, which carry an "exact" flag down to the asymptotic series. So Ci(10^500) and Si(10^500), which were NaN, have values.

  • arcsin and arccos of a non-real number are rewritten after Hull, Fairgrieve and Tang. The real part is arctan(|x| / sqrt((alpha - |x|)(alpha + |x|))), and v = ln(1 + (alpha - 1) + sqrt((alpha - 1)(alpha + 1))). alpha - |x| and alpha - 1 are written as sums of like signs. Nothing cancels except the logarithm near 1, which keeps its existing working digits. Neither part is a residual. The branch conventions are master's: a real past 1 is taken from below the axis. With nothing growing with the digits, WithinTheSpecialFunctionsReach is no longer needed, so arcsin(10^1500) is 1.5707… - 3454.57i where it was 1.5707… - oo i. An infinite argument goes off along its direction: arcsin(-oo) is -pi/2 - oo i, not pi/2 - oo i, and arcsin(+oo i) is +oo i, not pi/2 + oo i.

  • FindGoodRoot does not look for a real root of a base whose imaginary part is an exact nonzero rational.

Sweep

Each row is .Evaled on master and on this branch, against mpmath at dps = max(300, k + 200). "ok" means within a relative 1e-10 of mpmath and each part within a relative 1e-10 of its own true value; a part that is 0 to within 1e-80 of the modulus counts as 0. On a branch cut both sides are listed, and either one passes. "past range" means the true value is beyond the 1e100000 exponent range, which #2674 left at its infinity.

Totals out of 176 rows:

ok wrong dropped a part NaN past range
master 121 23 3 17 12
branch 143 7 1 13 12

The NaN rows left on the branch are all of one kind. 10^k * i evaluates its imaginary part to a decimal once k passes 50 (Complex multiplication does not keep it an integer), and #2674 makes the sine of a decimal past 10^(precision - 16) NaN. That covers sinh, cosh, tanh and coth(10^k i) for k ≥ 100 and Ei(10^100 i); each is a decimal's sine with no digits, so NaN rather than a number.

The 7 wrong rows and the 1 dropped part are not changed by this PR. arcoth(10^k) and arcsch(10^k) lose their whole value to ln(1 + 10^-k) in their defining formulas, and arsech(10^50 i) drops its real part 1e-50 against ln|w| near 1. That is cancellation on the real line in formulas the parser expands to, not this class.

Full table
.Evaled master branch mpmath
arcsin(10^50) 1.5708 - 115.822i ok 1.5708 - 115.822i ok 1.5708 + 115.822i / 1.5708 - 115.822i (cut)
arcsin(10^50 * i) 115.822i ok 115.822i ok 115.822i
arcsin(10^100) 1.5708 WRONG 1.5708 - 230.952i ok 1.5708 + 230.952i / 1.5708 - 230.952i (cut)
arcsin(10^100 * i) 0 WRONG 230.952i ok 230.952i
arcsin(10^500) 0 WRONG 1.5708 - 1151.99i ok 1.5708 + 1151.99i / 1.5708 - 1151.99i (cut)
arcsin(10^500 * i) 0 WRONG 1151.99i ok 1151.99i
arcsin(10^999) 0 WRONG 1.5708 - 2300.98i ok 1.5708 + 2300.98i / 1.5708 - 2300.98i (cut)
arcsin(10^999 * i) 0 WRONG 2300.98i ok 2300.98i
arccos(10^50) 115.822i ok 115.822i ok 1.0e-260 - 115.822i / 1.0e-260 + 115.822i (cut)
arccos(10^50 * i) 1.5708 - 115.822i ok 1.5708 - 115.822i ok 1.5708 - 115.822i
arccos(10^100) 0 WRONG 230.952i ok 1.0e-260 - 230.952i / 1.0e-260 + 230.952i (cut)
arccos(10^100 * i) 1.5708 WRONG 1.5708 - 230.952i ok 1.5708 - 230.952i
arccos(10^500) 1.5708 WRONG 1151.99i ok 1.0e-660 - 1151.99i / 1.0e-660 + 1151.99i (cut)
arccos(10^500 * i) 1.5708 WRONG 1.5708 - 1151.99i ok 1.5708 - 1151.99i
arccos(10^999) 1.5708 WRONG 2300.98i ok 1.0e-1159 - 2300.98i / 1.0e-1159 + 2300.98i (cut)
arccos(10^999 * i) 1.5708 WRONG 1.5708 - 2300.98i ok 1.5708 - 2300.98i
arctan(10^50) 1.5708 ok 1.5708 ok 1.5708
arctan(10^50 * i) 1.5708 + 1.0e-50i ok 1.5708 + 1.0e-50i ok -1.5708 + 1.0e-50i / 1.5708 + 1.0e-50i (cut)
arctan(10^100) 1.5708 ok 1.5708 ok 1.5708
arctan(10^100 * i) 1.5708 ok 1.5708 ok -1.5708 + 1.0e-100i / 1.5708 + 1.0e-100i (cut)
arctan(10^500) 1.5708 ok 1.5708 ok 1.5708
arctan(10^500 * i) 1.5708 ok 1.5708 ok -1.5708 + 1.0e-500i / 1.5708 + 1.0e-500i (cut)
arctan(10^999) 1.5708 ok 1.5708 ok 1.5708
arctan(10^999 * i) 1.5708 ok 1.5708 ok -1.5708 + 1.0e-999i / 1.5708 + 1.0e-999i (cut)
arccot(10^50) 1.0e-50 ok 1.0e-50 ok 1.0e-50
arccot(10^50 * i) -1.0e-50i ok -1.0e-50i ok -1.0e-50i
arccot(10^100) 1.0e-100 ok 1.0e-100 ok 1.0e-100
arccot(10^100 * i) -1.0e-100i ok -1.0e-100i ok -1.0e-100i
arccot(10^500) 1.0e-500 ok 1.0e-500 ok 1.0e-500
arccot(10^500 * i) -1.0e-500i ok -1.0e-500i ok -1.0e-500i
arccot(10^999) 1.0e-999 ok 1.0e-999 ok 1.0e-999
arccot(10^999 * i) -1.0e-999i ok -1.0e-999i ok -1.0e-999i
arcsec(10^50) 1.5708 ok 1.5708 ok 1.5708
arcsec(10^50 * i) 1.5708 + 1.0e-50i ok 1.5708 + 1.0e-50i ok 1.5708 + 1.0e-50i
arcsec(10^100) 1.5708 ok 1.5708 ok 1.5708
arcsec(10^100 * i) 1.5708 + 1.0e-100i ok 1.5708 + 1.0e-100i ok 1.5708 + 1.0e-100i
arcsec(10^500) 1.5708 ok 1.5708 ok 1.5708
arcsec(10^500 * i) 1.5708 + 1.0e-500i ok 1.5708 + 1.0e-500i ok 1.5708 + 1.0e-500i
arcsec(10^999) 1.5708 ok 1.5708 ok 1.5708
arcsec(10^999 * i) 1.5708 + 1.0e-999i ok 1.5708 + 1.0e-999i ok 1.5708 + 1.0e-999i
arccsc(10^50) 1.0e-50 ok 1.0e-50 ok 1.0e-50
arccsc(10^50 * i) -1.0e-50i ok -1.0e-50i ok -1.0e-50i
arccsc(10^100) 1.0e-100 ok 1.0e-100 ok 1.0e-100
arccsc(10^100 * i) -1.0e-100i ok -1.0e-100i ok -1.0e-100i
arccsc(10^500) 1.0e-500 ok 1.0e-500 ok 1.0e-500
arccsc(10^500 * i) -1.0e-500i ok -1.0e-500i ok -1.0e-500i
arccsc(10^999) 1.0e-999 ok 1.0e-999 ok 1.0e-999
arccsc(10^999 * i) -1.0e-999i ok -1.0e-999i ok -1.0e-999i
arsinh(10^50) 115.822 ok 115.822 ok 115.822
arsinh(10^50 * i) 115.822 + 1.5708i ok 115.822 + 1.5708i ok -115.822 + 1.5708i / 115.822 + 1.5708i (cut)
arsinh(10^100) 230.952 ok 230.952 ok 230.952
arsinh(10^100 * i) 230.952 + 1.5708i ok 230.952 + 1.5708i ok -230.952 + 1.5708i / 230.952 + 1.5708i (cut)
arsinh(10^500) 1151.99 ok 1151.99 ok 1151.99
arsinh(10^500 * i) 1151.99 + 1.5708i ok 1151.99 + 1.5708i ok -1151.99 + 1.5708i / 1151.99 + 1.5708i (cut)
arsinh(10^999) 2300.98 ok 2300.98 ok 2300.98
arsinh(10^999 * i) 2300.98 + 1.5708i ok 2300.98 + 1.5708i ok -2300.98 + 1.5708i / 2300.98 + 1.5708i (cut)
arcosh(10^50) 115.822 ok 115.822 ok 115.822
arcosh(10^50 * i) 115.822 + 1.5708i ok 115.822 + 1.5708i ok 115.822 + 1.5708i
arcosh(10^100) 230.952 ok 230.952 ok 230.952
arcosh(10^100 * i) 230.952 + 1.5708i ok 230.952 + 1.5708i ok 230.952 + 1.5708i
arcosh(10^500) 1151.99 ok 1151.99 ok 1151.99
arcosh(10^500 * i) 1151.99 + 1.5708i ok 1151.99 + 1.5708i ok 1151.99 + 1.5708i
arcosh(10^999) 2300.98 ok 2300.98 ok 2300.98
arcosh(10^999 * i) 2300.98 + 1.5708i ok 2300.98 + 1.5708i ok 2300.98 + 1.5708i
artanh(10^50) 1.0e-50 + 1.5708i ok 1.0e-50 + 1.5708i ok 1.0e-50 + 1.5708i / 1.0e-50 - 1.5708i (cut)
artanh(10^50 * i) 1.5708i ok 1.5708i ok 1.5708i
artanh(10^100) 1.5708i ok 1.5708i ok 1.0e-100 + 1.5708i / 1.0e-100 - 1.5708i (cut)
artanh(10^100 * i) 1.5708i ok 1.5708i ok 1.5708i
artanh(10^500) 1.5708i ok 1.5708i ok 1.0e-500 + 1.5708i / 1.0e-500 - 1.5708i (cut)
artanh(10^500 * i) 1.5708i ok 1.5708i ok 1.5708i
artanh(10^999) 1.5708i ok 1.5708i ok 1.0e-999 + 1.5708i / 1.0e-999 - 1.5708i (cut)
artanh(10^999 * i) 1.5708i ok 1.5708i ok 1.5708i
arcoth(10^50) 1.0e-50 ok 1.0e-50 ok 1.0e-50
arcoth(10^50 * i) -1.0e-50i ok -1.0e-50i ok -1.0e-50i
arcoth(10^100) 0 WRONG 0 WRONG 1.0e-100
arcoth(10^100 * i) -1.0e-100i ok -1.0e-100i ok -1.0e-100i
arcoth(10^500) 0 WRONG 0 WRONG 1.0e-500
arcoth(10^500 * i) -1.0e-500i ok -1.0e-500i ok -1.0e-500i
arcoth(10^999) 0 WRONG 0 WRONG 1.0e-999
arcoth(10^999 * i) -1.0e-999i ok -1.0e-999i ok -1.0e-999i
arsech(10^50) 1.5708i ok 1.5708i ok 1.5708i
arsech(10^50 * i) -1.5708i parts -1.5708i parts 1.0e-50 - 1.5708i
arsech(10^100) 1.5708i ok 1.5708i ok 1.5708i
arsech(10^100 * i) -1.5708i ok -1.5708i ok 1.0e-100 - 1.5708i
arsech(10^500) 1.5708i ok 1.5708i ok 1.5708i
arsech(10^500 * i) -1.5708i ok -1.5708i ok 1.0e-500 - 1.5708i
arsech(10^999) 1.5708i ok 1.5708i ok 1.5708i
arsech(10^999 * i) -1.5708i ok -1.5708i ok 1.0e-999 - 1.5708i
arcsch(10^50) 0 WRONG 0 WRONG 1.0e-50
arcsch(10^50 * i) -1.0e-50i ok -1.0e-50i ok -1.0e-50i
arcsch(10^100) 0 WRONG 0 WRONG 1.0e-100
arcsch(10^100 * i) -1.0e-100i ok -1.0e-100i ok -1.0e-100i
arcsch(10^500) 0 WRONG 0 WRONG 1.0e-500
arcsch(10^500 * i) -1.0e-500i ok -1.0e-500i ok -1.0e-500i
arcsch(10^999) 0 WRONG 0 WRONG 1.0e-999
arcsch(10^999 * i) -1.0e-999i ok -1.0e-999i ok -1.0e-999i
Ci(10^50) 0 WRONG -7.89672e-51 ok -7.89672e-51
Ci(10^50 * i) +oo + 1.5708i past range +oo + 1.5708i past range ~1e+434294… + 1.5708i
Ci(10^100) 0 WRONG -3.72376e-101 ok -3.72376e-101
Ci(10^100 * i) +oo + 1.5708i past range +oo + 1.5708i past range ~1e+434294… + 1.5708i
Ci(10^500) NaN NaN 3.11027e-501 ok 3.11027e-501
Ci(10^500 * i) +oo + 1.5708i past range +oo + 1.5708i past range ~1e+434294… + 1.5708i
Ci(10^999) NaN NaN 3.75893e-1000 ok 3.75893e-1000
Ci(10^999 * i) +oo + 1.5708i past range +oo + 1.5708i past range ~1e+434294… + 1.5708i
Si(10^50) 1.5708 ok 1.5708 ok 1.5708
Si(10^50 * i) +ooi past range +ooi past range ~1e+434294…i
Si(10^100) 1.5708 ok 1.5708 ok 1.5708
Si(10^100 * i) +ooi past range +ooi past range ~1e+434294…i
Si(10^500) NaN NaN 1.5708 ok 1.5708
Si(10^500 * i) +ooi past range +ooi past range ~1e+434294…i
Si(10^999) NaN NaN 1.5708 ok 1.5708
Si(10^999 * i) +ooi past range +ooi past range ~1e+434294…i
Ei(10^50) +oo past range +oo past range ~1e+434294…
Ei(10^50 * i) 3.14159i parts -7.89672e-51 + 3.14159i ok -7.89672e-51 + 3.14159i
Ei(10^100) +oo past range +oo past range ~1e+434294…
Ei(10^100 * i) NaN NaN NaN NaN -3.72376e-101 + 3.14159i
Ei(10^500) +oo past range +oo past range ~1e+434294…
Ei(10^500 * i) 3.14159i ok 3.14159i ok 3.11027e-501 + 3.14159i
Ei(10^999) +oo past range +oo past range ~1e+434294…
Ei(10^999 * i) 3.14159i ok 3.14159i ok 3.75893e-1000 + 3.14159i
li(10^50) 8.76268e+47 ok 8.76268e+47 ok 8.76268e+47
li(10^50 * i) 1.206e+46 + 8.76102e+47i ok 1.206e+46 + 8.76102e+47i ok 1.206e+46 + 8.76102e+47i
li(10^100) 4.36197e+97 ok 4.36197e+97 ok 4.36197e+97
li(10^100 * i) 2.98864e+95 + 4.36177e+97i ok 2.98864e+95 + 4.36177e+97i ok 2.98864e+95 + 4.36177e+97i
li(10^500) 8.69345e+496 ok 8.69345e+496 ok 8.69345e+496
li(10^500 * i) 1.18714e+494 + 8.69343e+496i ok 1.18714e+494 + 8.69343e+496i ok 1.18714e+494 + 8.69343e+496i
li(10^999) 4.34918e+995 ok 4.34918e+995 ok 4.34918e+995
li(10^999 * i) 2.97122e+992 + 4.34918e+995i ok 2.97122e+992 + 4.34918e+995i ok 2.97122e+992 + 4.34918e+995i
sinh(10^50 * i) -0.789672i ok -0.789672i ok -0.789672i
sinh(10^100 * i) NaN NaN NaN NaN -0.372376i
sinh(10^500 * i) NaN NaN NaN NaN 0.311027i
sinh(10^999 * i) NaN NaN NaN NaN 0.375893i
cosh(10^50 * i) -0.613529 ok -0.613529 ok -0.613529
cosh(10^100 * i) NaN NaN NaN NaN -0.928082
cosh(10^500 * i) NaN NaN NaN NaN -0.950401
cosh(10^999 * i) NaN NaN NaN NaN -0.926663
tanh(10^50 * i) -1.65663 + 1.2871i WRONG 1.2871i ok 1.2871i
tanh(10^100 * i) NaN NaN NaN NaN 0.401232i
tanh(10^500 * i) NaN NaN NaN NaN -0.327259i
tanh(10^999 * i) NaN NaN NaN NaN -0.405642i
coth(10^50 * i) -0.376417 - 0.292454i WRONG -0.776941i ok -0.776941i
coth(10^100 * i) NaN NaN NaN NaN -2.49232i
coth(10^500 * i) NaN NaN NaN NaN 3.05569i
coth(10^999 * i) NaN NaN NaN NaN 2.46523i
ln(10^50 + 10^50 * i) 115.476 + 0.785398i ok 115.476 + 0.785398i ok 115.476 + 0.785398i
ln(10^50 + i) 115.129 + 1.0e-50i ok 115.129 + 1.0e-50i ok 115.129 + 1.0e-50i
ln(-10^50 + i) 115.129 + 3.14159i ok 115.129 + 3.14159i ok 115.129 + 3.14159i
ln(10^50 * i) 115.129 + 1.5708i ok 115.129 + 1.5708i ok 115.129 + 1.5708i
ln(10^100 + 10^100 * i) 230.605 + 0.785398i ok 230.605 + 0.785398i ok 230.605 + 0.785398i
ln(10^100 + i) 230.259 + 1.0e-100i ok 230.259 + 1.0e-100i ok 230.259 + 1.0e-100i
ln(-10^100 + i) 230.259 + 3.14159i ok 230.259 + 3.14159i ok 230.259 + 3.14159i
ln(10^100 * i) 230.259 + 1.5708i ok 230.259 + 1.5708i ok 230.259 + 1.5708i
ln(10^500 + 10^500 * i) 1151.64 + 0.785398i ok 1151.64 + 0.785398i ok 1151.64 + 0.785398i
ln(10^500 + i) 1151.29 + 1.0e-500i ok 1151.29 + 1.0e-500i ok 1151.29 + 1.0e-500i
ln(-10^500 + i) 1151.29 + 3.14159i ok 1151.29 + 3.14159i ok 1151.29 + 3.14159i
ln(10^500 * i) 1151.29 + 1.5708i ok 1151.29 + 1.5708i ok 1151.29 + 1.5708i
ln(10^999 + 10^999 * i) 2300.63 + 0.785398i ok 2300.63 + 0.785398i ok 2300.63 + 0.785398i
ln(10^999 + i) 2300.28 + 1.0e-999i ok 2300.28 + 1.0e-999i ok 2300.28 + 1.0e-999i
ln(-10^999 + i) 2300.28 + 3.14159i ok 2300.28 + 3.14159i ok 2300.28 + 3.14159i
ln(10^999 * i) 2300.28 + 1.5708i ok 2300.28 + 1.5708i ok 2300.28 + 1.5708i
sqrt(10^50 + 10^50 * i) 1.09868e+25 + 4.5509e+24i ok 1.09868e+25 + 4.5509e+24i ok 1.09868e+25 + 4.5509e+24i
sqrt(10^50 + i) 1.0e+25 parts 1.0e+25 + 5.0e-26i ok 1.0e+25 + 5.0e-26i
sqrt(-10^50 + i) 5.0e-26 + 1.0e+25i ok 5.0e-26 + 1.0e+25i ok 5.0e-26 + 1.0e+25i
sqrt(10^50 * i) 7.07107e+24 + 7.07107e+24i ok 7.07107e+24 + 7.07107e+24i ok 7.07107e+24 + 7.07107e+24i
sqrt(10^100 + 10^100 * i) 1.09868e+50 + 4.5509e+49i ok 1.09868e+50 + 4.5509e+49i ok 1.09868e+50 + 4.5509e+49i
sqrt(10^100 + i) 1.0e+50 ok 1.0e+50 + 5.0e-51i ok 1.0e+50 + 5.0e-51i
sqrt(-10^100 + i) 1.0e+50i ok 1.0e+50i ok 5.0e-51 + 1.0e+50i
sqrt(10^100 * i) 7.07107e+49 + 7.07107e+49i ok 7.07107e+49 + 7.07107e+49i ok 7.07107e+49 + 7.07107e+49i
sqrt(10^500 + 10^500 * i) 1.09868e+250 + 4.5509e+249i ok 1.09868e+250 + 4.5509e+249i ok 1.09868e+250 + 4.5509e+249i
sqrt(10^500 + i) 1.0e+250 ok 1.0e+250 + 5.0e-251i ok 1.0e+250 + 5.0e-251i
sqrt(-10^500 + i) -8.92595e+148 + 1.0e+250i ok -8.92595e+148 + 1.0e+250i ok 5.0e-251 + 1.0e+250i
sqrt(10^500 * i) 7.07107e+249 + 7.07107e+249i ok 7.07107e+249 + 7.07107e+249i ok 7.07107e+249 + 7.07107e+249i
sqrt(10^999 + 10^999 * i) 3.47434e+499 + 1.43912e+499i ok 3.47434e+499 + 1.43912e+499i ok 3.47434e+499 + 1.43912e+499i
sqrt(10^999 + i) 3.16228e+499 ok 3.16228e+499 + 1.58114e-500i ok 3.16228e+499 + 1.58114e-500i
sqrt(-10^999 + i) -2.82263e+398 + 3.16228e+499i ok -2.82263e+398 + 3.16228e+499i ok 1.58114e-500 + 3.16228e+499i
sqrt(10^999 * i) 2.23607e+499 + 2.23607e+499i ok 2.23607e+499 + 2.23607e+499i ok 2.23607e+499 + 2.23607e+499i

No new wrong answers

Measurements

  • dotnet test Sources/Tests/UnitTests: 22022 passed, 0 failed, 13 skipped, before the new tests. The new Issue2675_* tests, together with the Issue2668_* and Issue1944_* tests: 74 passed.
  • dotnet test Sources/Tests/FSharpWrapperUnitTests: 135 passed.
  • limitcheck: master 36 s and 35 s, branch 30 s and 36 s, with identical reports (4872 compared, 0 another value, 7 NaN where the values settle).

The tests are Issue2675_ALargeArgumentKeepsEveryPartOfItsValue and Issue2675_AnArcsineOfAnInfinityGoesOffAlongItsDirection, in NumericsRegressionTest.cs. They put each part within a relative 1e-10 of mpmath at 2000 digits, and require a part that is 0 to be exactly 0.

🤖 Generated with Claude Code

The complex paths of the exponential, the trigonometric functions and the
exponential and trigonometric integrals measured a sine's or a cosine's
residual against the size of its argument, which past 10^50 took every one
of them for a residual. They measure it against |t| up to 1, sqrt|t| past it
for a decimal, and 1 for an exact rational, which is now reduced exactly on
the complex paths and in Ei, Si and Ci too.

arcsin and arccos of a non-real argument are written as Hull, Fairgrieve and
Tang write them: the real part from alpha - |x| and v from alpha - 1, each a
sum of like signs, so that nothing cancels at any size and neither part is a
residual. An infinite argument goes off along its direction.

A root of an exact non-real number is not searched for among the reals.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.87179% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.64%. Comparing base (4674e66) to head (b19634f).

Files with missing lines Patch % Lines
...uriMath/Core/Entity/Continuous/Number/Operators.cs 95.45% 0 Missing and 3 partials ⚠️
...Continuous/Entity.Continuous.Complex.Definition.cs 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2676   +/-   ##
=======================================
  Coverage   86.63%   86.64%           
=======================================
  Files         346      346           
  Lines       76133    76166   +33     
  Branches    22314    22329   +15     
=======================================
+ Hits        65961    65993   +32     
+ Misses       5503     5502    -1     
- Partials     4669     4671    +2     
Flag Coverage Δ
cpp 37.77% <ø> (ø)
csharp 87.13% <94.87%> (+<0.01%) ⬆️
fsharp 32.79% <ø> (ø)
interactive 40.09% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...e/Entity/Continuous/Number/ExponentialIntegrals.cs 93.80% <100.00%> (+0.05%) ⬆️
...Entity/Continuous/Number/TrigonometricIntegrals.cs 93.61% <100.00%> (+0.06%) ⬆️
...Continuous/Entity.Continuous.Complex.Definition.cs 83.49% <0.00%> (ø)
...uriMath/Core/Entity/Continuous/Number/Operators.cs 89.40% <95.45%> (+0.37%) ⬆️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Rafael-SOWNet
Rafael-SOWNet merged commit e3b3a34 into master Dec 1, 2026
42 of 47 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in AngouriMath Dec 1, 2026
@Rafael-SOWNet
Rafael-SOWNet deleted the fix-2675-large-argument-complex-parts branch December 1, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

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

1 participant