• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stillwater-sc / universal / 26306743851
84%
master: 84%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 22 May 2026 07:32PM UTC
Jobs 1
Files 651
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

22 May 2026 07:05PM UTC coverage: 84.243% (+0.001%) from 84.242%
26306743851

push

github

web-flow
perf(elreal): Phase L.2.b -- depth-2 refinement for sqrt (#920)

Phase L.2.b of follow-up epic #903 (#906). Adds depth-2 to elreal::sqrt
via a new gen_newton_sqrt variant alternative.

Algorithm
---------

Let R = a - (c_0 + c_1)^2. Expanding and grouping by magnitude:

  R = a.at(0) - c_0^2 + a.at(1) + a.at(2) - 2*c_0*c_1 - c_1^2

The O(1) terms are zero (by leading double); O(eps) terms are zero
(by definition of c_1); the O(eps^2) terms reduce to:

  R.at(2) ~= a.at(2) - c_1 * c_1

Setting R.at(2) -> 0 at higher order and solving for c_2:

  c_2 = (a.at(2) - c_1 * c_1) / (2 * c_0)

Self-interaction term
---------------------

Unlike gen_newton_div (which returns 0 for pure-double inputs because
all the depth-2 operand contributions are 0), gen_newton_sqrt has a
*self-interaction* term c_1 * c_1. This term is non-zero whenever c_1
is non-zero, regardless of operand depth.

Consequence: depth-2 of sqrt is non-trivial for pure-double inputs:

  sqrt(2): c_2 = -3.30e-33  (= -c_1^2 / (2*c_0) for c_1 = -9.67e-17)
  sqrt(3): c_2 = -2.91e-33
  sqrt(5): c_2 = -...

Perfect squares (sqrt(4), sqrt(100), etc.) still have c_1 = 0 and
hence c_2 = 0 -- the expected behavior since the leading double IS
the exact answer.

Files
-----

- include/sw/universal/number/elreal/elreal_data.hpp -- new
  gen_newton_sqrt variant alternative. Added to the lazy_generator
  variant.

- include/sw/universal/number/elreal/elreal_impl.hpp -- sqrt() now
  installs gen_newton_sqrt instead of gen_sqrt. The evaluator
  handles k=1 (legacy gen_sqrt formula) and k=2 (Phase L.2.b
  formula). k >= 3 returns 0.

- elastic/elreal/math/sqrt_depth2.cpp -- new test (target:
  elreal_sqrt_depth2) validating:
    * non-perfect-square pure-double inputs (sqrt(2..7, 1.5)) yield
      non-zero c_2 with non-overlap holding
    * perfect-square pure-double inputs (sqrt(1..10000)) yield c_2 = 0
      (and c_1 = 0)
    * multi-component input sqrt(pi) yields non-zero c_2
    * direct at(2) call auto-ma... (continued)

46948 of 55729 relevant lines covered (84.24%)

5276432.17 hits per line

Coverage Regressions

Lines Coverage ∆ File
1
80.8
0.0% include/sw/universal/number/posit1/specialized/posit_16_1.hpp
Jobs
ID Job ID Ran Files Coverage
1 26306743851.1 22 May 2026 07:32PM UTC 651
84.24
GitHub Action Run
Source Files on build 26306743851
  • Tree
  • List 651
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #26306743851
  • 52f2dbf2 on github
  • Prev Build on main (#26291830638)
  • Next Build on main (#26316090523)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc