Skip to content

erfc far out on the right returns at once, and keeps its real part on the imaginary axis - #1609

Merged
Rafael-SOWNet merged 2 commits into
masterfrom
erfc-asymptotic-digits
Sep 30, 2026
Merged

Rafael-SOWNet merged 2 commits into
masterfrom
erfc-asymptotic-digits

Conversation

@Rafael-SOWNet

@Rafael-SOWNet Rafael-SOWNet commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

erfc(70) took 5.3 s, erfc(100) over 20 s, and erfc(1000) did not return. Each is below what the default precision represents and answers 0.

Number.Erfc worked out one working precision for both of its branches. It added Re(z^2)/ln 10 digits for the cancellation in 1 - erf(z), which only the series branch forms. Past the series' reach, erfc is its asymptotic series, which cancels nothing, yet it was carried with those digits too: 4343 at 100, and at 1000 the cap of 43430. That branch now works at the guard digits alone, as the method's documentation already said.

The same branch lost erfc's real part on the imaginary axis, where erfc(i y) is exactly 1 - i erfi(y). The asymptotic series leaves the 1 out, below its precision beside erfi(y), so erfc(20i) came back with a real part of 0. On the axis it is now 1 - erf(z), since erf already reads erf(i y) as i erfi(y). This turned up while comparing a double-precision erfc against the kernel for #1607.

Measured

master this
erfc(70) 5.3 s 9 ms
erfc(100) > 20 s 3 ms
erfc(1000) no return 3 ms
erfc(1000 + i) no return 13 ms
  • No value changes. I evaluated fourteen arguments in the asymptotic branch to 100 digits with downcasting off, from erfc(15.6) to erfc(100 + 99.5i), on both sides of the real line. All are identical to master's to the last digit.
  • ErrorFunctionTest gains three rows in that branch, erfc(16), erfc(16 + 3i) and erfc(14 - 9i), which agree with mpmath at 200 digits to 40 digits. mpmath gives the same values at 400. It also gains erfc(20i), whose real part of 1 fails without the second commit ("expected 1, got 0E-199").
  • It also gains a termination test, erfc(1000) and erfc(1000 + i) within 30 s. On master both fail. erfc(100) is not a row: it finishes in about 25 s, inside the budget, so it would not bind.
  • The library builds for every target framework. The unit suite on b29be05 (net10.0): 13880 passed, 0 failed. ErrorFunctionTest on 0f19463: 44 of 44.

Closes #1606.

🤖 Generated with Claude Code

…ot carried with the digits 1 - erf(z) would cancel

Number.Erfc worked out one working precision for both of its branches, with Re(z^2)/ln 10
digits over for the cancellation in 1 - erf(z). Only the series branch forms that difference.
Past the series' reach erfc is its asymptotic series, which cancels nothing, and the digits
still grew as Re(z^2): 4343 at 100, and 43430, the cap, at 1000. erfc(70) took 5.3 s,
erfc(100) over 20 s, and erfc(1000) did not return. Each is below what the default precision
represents, and answers 0.

The asymptotic branch now works at the guard digits alone, as the method's documentation
already said it did. erfc(70) takes 9 ms, erfc(100) 3 ms, erfc(1000) 3 ms.

No value changes. Fourteen arguments in the asymptotic branch, evaluated to 100 digits with
downcasting off, are identical to master's to the last digit. Three new rows agree with mpmath
at 200 digits to 40 digits, and mpmath gives the same values at 400. The new termination test
fails on master for erfc(1000) and erfc(1000 + i).

Closes #1606.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet added this to the 2.6.0 milestone Sep 30, 2026
…reach

erfc(i y) is 1 - i erfi(y) exactly. Past the series' reach the asymptotic series gave erfc
directly, and it leaves the 1 out, below its precision beside erfi(y): erfc(20 i) came back with
a real part of 0. On the axis erfc is 1 - erf(z) instead, as erf already reads erf(i y) as
i erfi(y), and Cancelled adds nothing there.

Found comparing a double-precision erfc against the kernel for #1607. ErrorFunctionTest gains
erfc(20 i), against mpmath at 200 digits. It fails without this with "expected 1, got 0E-199".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rafael-SOWNet Rafael-SOWNet changed the title erfc far out on the right returns at once erfc far out on the right returns at once, and keeps its real part on the imaginary axis Sep 30, 2026
@Rafael-SOWNet
Rafael-SOWNet merged commit f633765 into master Sep 30, 2026
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

erfc(x) takes seconds from x = 70, and past 20 s from x = 100

1 participant