Issue at hand: a simple json with 1 string field and 1 integer field ("cJSON_addNumber") - fails to be print_unformatted.
I saw https://github.com/DaveGamble/cJSON/issues/585 - and someone had a similar problem on my platform - esp8266 RTOS SDK).
And the reason of failure is due to some missing feature on my platform for sprintf'ing floating point numbers.
But...
a) what I want to use is NOT a floating point number and I should NOT have to compile in some additional functionality for floating numbers
b) the fix for the mentioned bug - https://github.com/DaveGamble/cJSON/pull/630/files is wrong.
You should never strictly compare floating point numbers (the integer value is most probably converted first to a floating number
https://www.cs.technion.ac.il/users/yechiel/c++-faq/floating-point-arith.html
Please check to see if you are having other such strict comparisons in your code.
Please treat integer numbers completely separate from floating ones.
Issue at hand: a simple json with 1 string field and 1 integer field ("cJSON_addNumber") - fails to be print_unformatted. I saw https://github.com/DaveGamble/cJSON/issues/585 - and someone had a similar problem on my platform - esp8266 RTOS SDK). And the reason of failure is due to some missing feature on my platform for sprintf'ing floating point numbers.
But... a) what I want to use is NOT a floating point number and I should NOT have to compile in some additional functionality for floating numbers b) the fix for the mentioned bug - https://github.com/DaveGamble/cJSON/pull/630/files is wrong. You should never strictly compare floating point numbers (the integer value is most probably converted first to a floating number https://www.cs.technion.ac.il/users/yechiel/c++-faq/floating-point-arith.html Please check to see if you are having other such strict comparisons in your code.
Please treat integer numbers completely separate from floating ones.