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

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

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 26 Apr 2026 12:17PM UTC
Jobs 1
Files 642
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

26 Apr 2026 11:50AM UTC coverage: 84.3% (-0.04%) from 84.337%
24955899585

push

github

web-flow
feat(math): add constexpr pow to sw::math::constexpr_math (#770)

* feat(math): add constexpr pow to sw::math::constexpr_math

Adds constexpr pow with two overload families to the constexpr_math
facility (#763 Epic, #423/PR #762, #764/PR #769 substrates). Tier-1
sub-issue: unblocks lns saturation/range constants (consumed by #722).

Two overloads per type (4 total: float and double):

1. Integer-exponent fast path: pow(T, int)
   - Fast exponentiation by squaring; pure integer logic.
   - O(log |n|) multiplications, no transcendentals.
   - Negative exponent via 1 / pow(x, -n) with safe long-long promotion
     to avoid INT_MIN overflow on negation.

2. General overload: pow(T, T)
   - Dispatches to the integer fast path when the floating-point
     exponent is exactly an integer (typical for compile-time constants).
   - For x > 0, finite y: pow(x, y) = exp2(y * log2(x)).
   - For x < 0, integer y: pow(|x|, y) with sign from y's parity.
   - For x < 0, non-integer y: NaN.
   - Full IEEE-754 special-case table per C99 7.12.7.4 (~20 cases):
     pow(x, 0) -> 1 (incl. NaN), pow(1, y) -> 1 (incl. NaN), pow(NaN, y),
     pow(x, NaN), pow(+/-0, y) by sign and y-parity, pow(+/-inf, y),
     pow(x, +/-inf) by |x| relative to 1, pow(-1, +/-inf), etc.

New helpers in detail.hpp:
  - is_integer(T)       -- exact-integer test, safe for huge doubles
                           (above 2^53 every value is necessarily integer)
  - is_odd_integer(T)   -- for negative-base sign rule
  - pow_by_squaring<T>  -- the squaring loop, used by both overloads

Test coverage in cm_pow:
  - 38 static_asserts: integer fast path positive/negative, negative
    base parity, all C99 7.12.7.4 special cases (NaN/inf/+-0 mixes)
  - Acceptance forms: pow(2, 10) == 1024, pow(2, 0.5) ~= sqrt(2),
    pow(8, 1/3) ~= 2
  - Runtime sweep over 21 (base, exponent) pairs vs std::pow
  - Float sweep over 7 (base, exponent) pairs

Out-of-band accuracy stress (100K random samples, positive base in
[... (continued)

109 of 155 new or added lines in 3 files covered. (70.32%)

6 existing lines in 2 files now uncovered.

45350 of 53796 relevant lines covered (84.3%)

6366762.75 hits per line

Uncovered Changes

Lines Coverage ∆ File
32
62.79
include/sw/math/constexpr_math/pow.hpp
14
61.11
internal/constexpr_math/api/pow.cpp

Coverage Regressions

Lines Coverage ∆ File
4
80.58
-0.89% include/sw/universal/number/posit1/specialized/posit_16_1.hpp
2
89.8
-0.57% include/sw/universal/number/posito/posito_impl.hpp
Jobs
ID Job ID Ran Files Coverage
1 24955899585.1 26 Apr 2026 12:17PM UTC 642
84.3
GitHub Action Run
Source Files on build 24955899585
  • Tree
  • List 642
  • Changed 4
  • Source Changed 1
  • Coverage Changed 4
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #24955899585
  • a18a12f8 on github
  • Prev Build on main (#24948080228)
  • Next Build on main (#24956675961)
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