zephyr/tests/lib
Christoph Winklhofer fc37c02eb1 json: improve parsing and serializing of 'float' and 'double'
Up to now, the handling of type float was offloaded to the users of the
JSON utility, with the token JSON_TOK_FLOAT.

Improve handling of floating point types and support the types 'float'
and 'double' in a built-in way so that they can be directly parsed to
and serialized from variables (of type float or double).

The types are serialized in the shortest representation, either as a
decimal number or in scientific notation:
  * float (with JSON_TOK_FLOAT_FP): encoded with maximal 9 digits
  * double (with JSON_TOK_DOUBLE_FP): encoded with maximal 16 digits
  * NaN, Infinity, -Infinity: encoded and decoded as:
    {"nan_val":NaN,"inf_pos":Infinity,"inf_neg":-Infinity}

Enable the floating point functionality with the Kconfig option:
  JSON_LIBRARY_FP_SUPPORT=y

It requires a libc implementation with support for floating point
functions: strtof(), strtod(), isnan() and isinf().

Fixes: #59412
Signed-off-by: Christoph Winklhofer <cj.winklhofer@gmail.com>
2025-04-09 22:05:14 +02:00
..
acpi
c_lib everywhere: Replace diagnostic pragmas with TOOLCHAIN_* macros 2025-03-20 21:57:47 +01:00
cbprintf_fp
cbprintf_package
cmsis_dsp tests: unskip some tests 2025-03-28 21:52:13 +01:00
cmsis_nn tests: cmsis-nn: update tests for v7.0.0 2025-02-13 06:39:17 +01:00
cobs tests: utils: lib: cobs tests 2025-03-11 05:36:49 +01:00
cpp kscan: drop kscan and any reference 2025-03-13 16:56:26 +00:00
devicetree device: introduce struct device_ops 2025-03-10 21:32:40 +01:00
fdtable
gui/lvgl tests: Introduce greyscale-related tests modifications 2025-03-12 14:05:14 +00:00
hash_function
hash_map
heap
heap_align tests/lib/heap_align: improve test some more 2025-03-17 02:21:27 +01:00
json json: improve parsing and serializing of 'float' and 'double' 2025-04-09 22:05:14 +02:00
linear_range
lockfree
math/interpolation tests: fix various test ids and use existing scheme 2025-04-07 11:22:36 +02:00
mem_alloc everywhere: Use correct macro for gcc-specific warnings 2025-03-20 21:57:47 +01:00
mem_blocks
mem_blocks_stats
mpsc_pbuf boards native_posix: Remove twister support 2025-03-07 19:16:14 +01:00
multi_heap tests: lib: multi_heap: fix stack overflow 2025-03-12 07:15:12 +01:00
net_buf
newlib
notify
onoff
p4workq kernel: rename 'dumb' scheduler and simply call it 'simple' 2025-03-15 00:34:58 +01:00
ringbuffer ring_buffer: shrink size of struct ring_buf 2025-03-11 08:59:05 +01:00
shared_multi_heap
smf tests: lib: smf: Add missing equals 2025-01-20 16:27:10 +01:00
sprintf everywhere: Use correct macro for gcc-specific warnings 2025-03-20 21:57:47 +01:00
spsc_pbuf
sys_util
time boards native_posix: Remove twister support 2025-03-07 19:16:14 +01:00