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

nlohmann / json / 33953322464
98%

Build:
DEFAULT BRANCH: develop
Ran 05 Sep 2026 07:51AM UTC
Jobs 1
Files 31
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

05 Sep 2026 07:43AM UTC coverage: 98.718% (-0.03%) from 98.744%
33953322464

push

github

web-flow
Compare integers with floats exactly instead of widening the integer (#5459)

The mixed number arms of JSON_IMPLEMENT_OPERATOR cast the integer to
number_float_t before comparing. Past the float's mantissa that cast is lossy:
2^63-2 and 2^63-1 both round to 2^63, so each compares equal to that float
while differing from each other. Equality is therefore intransitive and the
ordering is not a strict weak ordering, which makes std::sort over such values,
or using them as keys in std::set or std::map, undefined behavior.

Compare the two exactly instead. The integer's range is a power of two the
float represents exactly, so a float outside it is ordered by magnitude alone;
inside it, truncating the float is exact, and the integer parts and then any
fractional part decide. The helper hands back a pair whose comparison with the
original operator reproduces that ordering, which keeps every operator's return
type as it was, including partial_ordering for the spaceship.

A NaN operand is returned in both members, so NaN stays false for the
relational operators and unordered for <=>. Values a float represents exactly
still compare equal, so json(1) == json(1.0) is unchanged.

Signed-off-by: qatcod <79017227+qatcod@users.noreply.github.com>

2195 of 2362 branches covered (92.93%)

18 of 20 new or added lines in 1 file covered. (90.0%)

6701 of 6788 relevant lines covered (98.72%)

16211063.34 hits per line

Uncovered Changes

Lines Coverage ∆ File
2
93.33
-6.67% include/nlohmann/detail/value_t.hpp
Jobs
ID Job ID Ran Files Coverage
1 33953322464.1 05 Sep 2026 07:51AM UTC 31
98.72
GitHub Action Run
Source Files on build 33953322464
  • Tree
  • List 31
  • Changed 2
  • Source Changed 2
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #33953322464
  • 137a40b9 on github
  • Prev Build on develop (#33680073636)
  • Next Build on develop (#33953757712)
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