Repository navigation
return zero from dec_to_float when the mantissa is zero - #1202
Ramya-9353 wants to merge 1 commit into
Conversation
|
An automated preview of the documentation is available at https://1202.json.prtest2.cppalliance.org/libs/json/doc/html/index.html If more commits are pushed to the pull request, the docs will rebuild at the same URL. 2026-10-08 11:03:07 UTC |
|
GCOVR code coverage report https://1202.json.prtest2.cppalliance.org/gcovr/index.html Build time: 2026-10-08 11:30:55 UTC |
|
|
916991c to
4dff941
Compare
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #1202 +/- ##
========================================
Coverage 93.98% 93.98%
========================================
Files 85 85
Lines 8973 8973
========================================
Hits 8433 8433
Misses 540 540
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
4dff941 to
47fb530
Compare
|
|



Repro:
parse("0e400")with default options returns a double that is NaN, andserializeof that value emitsnull, so the number changes JSON type on a round trip.0e309,-0e400,0.0e400and0E+400behave the same. The same literals give0and-0undernumber_precision::precise, and1e400gives infinity as intended.Cause:
dec_to_floatscales the mantissa withx * pow10(e), andpow10returns infinity for any exponent above 308. With a zero mantissa that product is0 * inf, which is NaN.Fix: return the already signed zero before the scaling when the mantissa is zero, so
-0e400gives-0.0like the precise path. The two addedgrind_doublecases fail on develop (13 assertions across the split points) and pass with the change.