Repository navigation
Add Fresnel integrals C(x), S(x) and C + iS - #1636
Merged
Merged
Conversation
fresnel_c, fresnel_s and fresnel_cis (also in Python), within an ulp in float, double and multiprecision: a double-word Maclaurin series, the even Laplace continued fraction for f and g, and an exact phase. Also names the temporaries of two_sum_error, which expression templates reassociated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fresnel_c, fresnel_s and fresnel_cis (also in Python), within an ulp in float, double and multiprecision:
a double-word Maclaurin series, the even Laplace continued fraction for f and g, and an exact phase.
Also names the temporaries of two_sum_error, which expression templates reassociated.
C(x) = ∫₀ˣ cos(πt²/2) dt and S(x) = ∫₀ˣ sin(πt²/2) dt, the convention of DLMF 7.2, A&S, Mathematica, mpmath, SciPy and Arb (
normalized = 1).fresnel_cis(x)returns C(x) + i S(x) = ∫₀ˣ cis(πt²/2) dt for the cost of one of them, asstd::complex<T>for float, double and long double, and as the matching Boost.Multiprecision complex type otherwise (viatools::detail::complex_from_real_t). In Python they areboost.math.fresnel_c,fresnel_sandfresnel_cis(complex128), elementwise over arrays like the other special functions.With θ = πx²/2 and p bits:
Relative error in ε against mpmath at 80 digits, max / mean:
promote_float<false>mpfr_floatis correctly rounded at 50, 100 and 200 digits, also after changing the precision at runtime (precision-dependent tables are cached only for compile-time precision).google/benchmark, double, -O2, Apple M-series:
fresnel_cis, seriestwo_sum_errorincompensated_arithmetic.hpp: with expression templates on (e.g.mpfr_float),(a - (s - bb)) + (b - bb)was reassociated, and for |a| < |b| the error came out as 0 instead of the rounding error of a + b (Fresnel at 100 digits was off by ~1e7 ε). Each difference now has a named temporary;fast_two_sumand the Veltkamp split get the same treatment. Struve, exp_sinh, the Gauss quadratures, Leja, 0F1, 2F0, Laguerre, Kolmogorov–Smirnov, Jacobi theta, beta and ibeta tests pass.🤖 Generated with Claude Code