Skip to content

Number decimal point#1046

Open
chmorgan wants to merge 4 commits into
DaveGamble:masterfrom
chmorgan:number_decimal_point
Open

Number decimal point#1046
chmorgan wants to merge 4 commits into
DaveGamble:masterfrom
chmorgan:number_decimal_point

Conversation

@chmorgan

@chmorgan chmorgan commented Jul 3, 2026

Copy link
Copy Markdown

This is #558 rebased against the latest master.

Changes from original PR:

  • Added tests to confirm the decimal place is honored when print formatting.
  • Fixed a dereference of NULL pointer that can occur if the number allocation fails.

Signed-off-by: Ajay Bhargav <contact@rickeyworld.info>
Signed-off-by: Ajay Bhargav <contact@rickeyworld.info>
Signed-off-by: Ajay Bhargav <contact@rickeyworld.info>
@chmorgan chmorgan force-pushed the number_decimal_point branch from 900fe33 to a525811 Compare July 3, 2026 12:00
Add public API regressions for cJSON_AddNumberWithPrecisionToObject formatting through
cJSON_PrintUnformatted.

The new cases assert fixed-width decimal output with preserved trailing zeroes, printf-style rounding,
negative number formatting, and the accepted max precision boundary.

Also cover invalid precision bounds by checking that 0 and 15 are rejected and leave the destination object empty.
@chmorgan chmorgan force-pushed the number_decimal_point branch from a525811 to d8a62e5 Compare July 3, 2026 12:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants