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

stillwater-sc / universal / 24881139213 / 1
84%
master: 84%

Build:
Build:
LAST BUILD BRANCH: chore/ascii-source-cleanup
DEFAULT BRANCH: master
Ran 24 Apr 2026 09:23AM UTC
Files 633
Run time 21s
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

24 Apr 2026 08:55AM UTC coverage: 84.371% (+0.004%) from 84.367%
24881139213.1

push

github

web-flow
feat(posit): enable constexpr IEEE-754 construction (Phase 2 of #713) (#717)

* feat(posit): enable constexpr IEEE-754 construction (Phase 2 of #713)

Phase 2 completes constexpr posit construction from numeric literals.
Float, double, and (where supported) long double inputs can now be used
in constant expressions:

  constexpr posit<32, 2> pi(3.14);     // now works
  constexpr posit<32, 2> npi(-3.14);   // now works
  constexpr posit<8,  0> pi8(3.14);    // now works
  constexpr posit<64, 3> big(1.0e100); // now works

Implementation:

1. encode_positive_with_scale_and_fraction(scale, frac, num_fbits, sat):
   Generalizes the integer-only encoder from Phase 1 to accept a separate
   scale and fraction-bit width. Handles negative scale via Euclidean
   division so the regime/exponent split works for sub-1.0 values. Handles
   negative regime (k<0) with the proper "(-k) zeros + 1 terminator"
   layout. encode_positive_uint64 is now a thin wrapper that derives
   scale = find_msb(v) - 1.

2. convert_ieee754 rewritten:
   - extractFields() (bit-cast based, BIT_CAST_CONSTEXPR) replaces frexp
   - Raw-exponent NaN/Inf check (rawExp == eallset) replaces std::isnan
     and std::isinf
   - Subnormals normalized via find_msb on rawFrac to produce a 1.frac'
     representation with scale = msb_pos - bias - fbits
   - For nbits <= 64: route to encode_positive_with_scale_and_fraction
     (sign applied via uint64 two's complement)
   - For nbits > 64: route to convert_<>() with a blocksignificand
     (convert_<>() became constexpr in PR #716)
   - Function marked BIT_CAST_CONSTEXPR (constexpr where __builtin_bit_cast
     is constexpr - gcc, clang, MSVC modern)

Tests:
- static/tapered/posit/api/api.cpp gets a "constexpr IEEE-754 construction"
  block covering posit<{8,16,32,64},{0,1,2,3}> from float and double, plus
  a subnormal float case (1e-40f) that exercises find_msb normalization.

Cross-compiler regression validation (gcc-13 + clang-18, -std=c++20):
... (continued)

44942 of 53267 relevant lines covered (84.37%)

6452764.52 hits per line

Source Files on job 24881139213.1
  • Tree
  • List 633
  • Changed 3
  • Source Changed 1
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 24881139213
  • a943617c on github
  • Prev Job for on main (#24864610179.1)
  • Next Job for on main (#24907312588.1)
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