Function anj_double_to_string_value

Function Documentation

size_t anj_double_to_string_value(char *out_buff, double value)

Convert a double to a string (without a terminating NUL).

This function is used to encode LwM2M attribute values whose textual format is defined as 1*DIGIT ["." 1*DIGIT]. For very large/small magnitudes (>|UINT64_MAX|, <1e-10) an exponential notation may be used. NaN and infinities are emitted as "nan" and "inf".

If ANJ_WITH_CUSTOM_CONVERSION_FUNCTIONS is enabled, a lightweight formatter is used (may incur rounding error at extreme magnitudes).

The buffer must be at least ANJ_DOUBLE_STR_MAX_LEN bytes long.

Returns:

Number of bytes written.