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

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

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 12 Oct 2026 12:43AM UTC
Jobs 1
Files 721
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

11 Oct 2026 11:54PM UTC coverage: 86.649% (+0.006%) from 86.643%
38186032370

push

github

web-flow
fix(posit): round posit to float, double and long double once, to nearest (#1679)

* fix(posit): round posit to float, double and long double once, to nearest

posit::to_native<Real>() summed the fraction bits in long double, MSB first, and
narrowed sign * scale * (1 + fraction) at the end (#1678). Past long double's
significand every further bit rounded on its own, adding the hidden bit rounded
again, and the narrowing a third time. On x87, posit<128,2> and posit<256,2> to
long double were not the nearest value in 12-13% of samples, and to double near a
midpoint they rounded twice (2 in 20000). posit<80,3> was affected too.

It now rounds once, from the bits: the hidden bit and the top p - 1 fraction bits,
p being Real's precision at the value's scale (fewer for a subnormal result),
round-to-nearest-even on the next bit and a sticky bit of the rest, and an exact
ldexp of that integer. Overflow gives inf and deep underflow a signed zero, as before.

- Up to 64 bits nothing changes on x87: a differential against main hashes float,
  double and long double of every posit<8,0..3>, <10,2>, <12,1>, <16,0..5> and of
  3.3M samples across <20..64, 0..5> to the same values, in less time (1.45 s vs 1.96 s).
- On platforms where long double is double (MSVC, Apple arm64) the old code also
  double-rounded posits with more than 52 fraction bits, posit<64,2> included; the
  new code does not depend on long double's width.

New static/tapered/posit/conversion/to_native_rounding.cpp checks that every float,
double and long double result is the nearest to the exact dyadic value (the poxel
over the same lattice decodes it, sharing no code with posit), with the overflow
threshold max + ulp/2: exhaustive posit<8,0>, <8,2>, <12,3>, <16,1>, <16,2>, sampled
<32..256, 2..5>, and the two reported cases. On main it fails every group wider than
64 bits and the reported cases.

Closes #1678

BEHAVIOUR-CHANGE: float/double/long double conversion of posits whose fraction is wider... (continued)

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

8 existing lines in 3 files now uncovered.

48877 of 56408 relevant lines covered (86.65%)

10184413.67 hits per line

Coverage Regressions

Lines Coverage ∆ File
6
77.78
-22.22% include/sw/universal/number/posit/posit_fraction.hpp
1
96.82
0.52% include/sw/universal/number/cfloat/cfloat_impl.hpp
1
95.24
-2.38% include/sw/universal/number/posit/posit_exponent.hpp
Jobs
ID Job ID Ran Files Coverage
1 38186032370.1 12 Oct 2026 12:43AM UTC 721
86.65
GitHub Action Run
Source Files on build 38186032370
  • Tree
  • List 721
  • Changed 4
  • Source Changed 1
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #38186032370
  • c2a5d351 on github
  • Prev Build on main (#38178895480)
  • Next Build on main (#38201098414)
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