If I run the following code:
int len;
char buf[10];
len = sprintf(buf, "%d", -1)); // len = 2: correct
len = sprintf(buf, "%.15g", (double)-1)); // len = 2: correct
len = sprintf(buf, "%1.15g", (double)-1)); // len = 1: incorrect
len = sprintf(buf, "%.15g", (double)1000)); // len = 4: correct
len = sprintf(buf, "%1.15g", (double)1000)); // len = 4 correct
Why is len 1 if %1.15g format is given? This should be 2. Other compilers like VS gives 2 as well.
I run this code on an i.MX RT1064, MCUxPressoIDE v11.4.0 Build 6237