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

stillwater-sc / universal / 34873878752
86%
master: 84%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 14 Sep 2026 05:56PM UTC
Jobs 1
Files 670
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

14 Sep 2026 05:17PM UTC coverage: 85.824% (+0.02%) from 85.802%
34873878752

push

github

web-flow
fix(dfixpnt): floor and ceil add a zeroed unit, not an uninitialized one (#1502)

floor() of a negative value with a fraction subtracts one unit, and ceil() of a positive one
adds it. Both built the unit as a default-constructed dfixpnt with one digit set. dfixpnt is
trivially constructible, so every other digit and the sign were indeterminate, and the
result depended on whatever was on the stack (#1476). For
dfixpnt<8, 3, BCD, Modulo, uint8_t>, floor(-12.375) came out as -46513 and ceil(12.375) as
46513 with gcc at -O2, and clang crashed inside floor(). Each function was wrong on half its
domain.

The unit now comes from UnitOf(), which zeroes the value first and then sets the units
digit. A type with no integer digits (radix == ndigits) cannot hold 1, and setdigit(radix,
1) wrote past the value there; with Modulo arithmetic 1 wraps to 0 anyway, so for those
types the unit is 0 and floor and ceil return the integer part, 0.

The new static/fixpnt/decimal/math/floor_ceil.cpp, in a new math folder of the dfixpnt
tests, builds each value from a scaled integer n and checks floor and ceil against integer
floor and ceiling division of n by 10^radix. It covers the BCD, BID and DPD encodings,
Modulo and Saturate arithmetic, and 8- to 64-bit limbs. Level 1 is exhaustive over every
value of dfixpnt<4,2> (both modes), <4,1>, <3,0> and <3,3>, plus the reported cases, and
samples <8,3>, <12,5> and <16,8>.

Verification: against main the test segfaults at -O2 on gcc 13.3 and clang. With the fix,
levels 1-4 pass on both, and all 15 dfixpnt and blockdecimal tests pass on both. The fix
also holds with -ftrivial-auto-var-init=pattern, which fills uninitialized stack memory with
a fixed pattern.

test(dfixpnt): check the no-integer-digit floor and ceil before the range filter

CodeRabbit on #1502. For a type with no integer digit, such as dfixpnt<3,3>, the reference
floor of a negative fraction and ceil of a positive one is -1000 or +1000, outside the
type's [-999, 999... (continued)

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

43864 of 51109 relevant lines covered (85.82%)

7940520.05 hits per line

Jobs
ID Job ID Ran Files Coverage
1 34873878752.1 14 Sep 2026 05:56PM UTC 670
85.82
GitHub Action Run
Source Files on build 34873878752
  • Tree
  • List 670
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #34873878752
  • 7daa877a on github
  • Prev Build on main (#34864593018)
  • Next Build on main (#34897454005)
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