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

stillwater-sc / universal / 39104311511
89%
master: 84%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 18 Oct 2026 06:49AM UTC
Jobs 1
Files 752
Run time 1min
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

18 Oct 2026 06:30AM UTC coverage: 87.377% (+0.01%) from 87.364%
39104311511

push

github

web-flow
fix(erational): sqrt returns the exact rational root, or the nearest dyadic at N bits (#1733)

erational sqrt was erational(std::sqrt(double(x))), 53 bits at most.
It also wrote "erational_negative_sqrt_arg" to std::cerr on EVERY call
when the throwing configuration was off, because the message sat
outside the sign test. The native branch of the ERATIONAL_NATIVE_SQRT
switch referenced names that do not exist and never compiled.

The root of a rational is rational exactly when the reduced numerator
and denominator are both perfect squares. sqrt then returns it exactly:
sqrt(9/4) is 3/2. Otherwise the root is irrational, and
sqrt(x, bits = 106) returns the nearest multiple of 2^-k to it, ties to
even. k = bits - 1 - floor(floor(log2 x) / 2), from exact bit lengths,
so that 2^(bits-1) <= sqrt(x) 2^k < 2^bits. With x = p/q, the result
is R / 2^k for R the integer nearest sqrt(p 4^k / q). R0 is
floor(sqrt(floor(A/B))), edecimal's exact integer root, and the root
rounds up exactly when 4A > (2 R0 + 1)^2 B. The result is reduced. The
switch is removed. A negative argument throws erational_negative_sqrt_arg
under the throw flag, and otherwise sets errno = EDOM and returns NaN.

elastic/rational/decimal/math/sqrt.cpp was an empty MANUAL_TESTING
stub. It now checks 73 vectors from tools/generators/erational_sqrt_gen.py,
the same definition evaluated with Python's exact integers (math.isqrt,
Fraction) and reproducible byte for byte. The vectors cover rationals of
up to 60 digits each at 1, 2, 10, 53, 106 and 200 bits, plus rational
roots. The test also checks the special values, with the throw flag on
and off. The old header cannot compile it: sqrt(x, bits) did not exist.

The argument is reduced first (by Euclid, on local copies). The
two-argument constructor does not reduce, and erational(8, 18) would
otherwise miss the exact root 2/3. bit_length starts from the bound the
decimal digit count gives, and pow2 is binary exponentiation, so neither
needs one multip... (continued)

58 of 58 new or added lines in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

51037 of 58410 relevant lines covered (87.38%)

10553177.66 hits per line

Coverage Regressions

Lines Coverage ∆ File
1
97.04
-0.06% include/sw/universal/number/cfloat/cfloat_impl.hpp
Jobs
ID Job ID Ran Files Coverage
1 39104311511.1 18 Oct 2026 06:49AM UTC 752
87.38
GitHub Action Run
Source Files on build 39104311511
  • Tree
  • List 752
  • Changed 4
  • Source Changed 1
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #39104311511
  • 441b52c8 on github
  • Prev Build on main (#39100454297)
  • Next Build on main (#39128875428)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc