3 issues that need to be resolved.
1) Some compilers, even with *printf()
using floating point specifiers, do not include FP support unless code has FP math elsewhere in the code. Insure code uses FP elsewhere or that the compiler does not have this limitation.
2) Use a buffer and *printf()
specifier that will not overflow. @Jonathan Leffler
"%e"
rather than "%f"
is an easy approach to avoid excessively long strings.
3) Print with sufficient precision.
#include <float.h>
// - d . ddddddd e - expo \0 spare
char str[1 + 1 + 1 + (DBL_DECIMAL_DIG - 1) + 1 + 1 + 5 + 1 + 10];
snprintf(str, sizeof str, "%.*e", DBL_DECIMAL_DIG - 1, d);
USBD_VCOM_SendString(str);