/* buf_size - 1 used here to ensure place for possible scale_IEC_I suffix. */
- num_size = snprintf (buf, buf_size - 1, fmt, val, suffix_power_char (power));
+ num_size = snprintf (buf, buf_size - 1, fmt, val, prec,
+ suffix_power_char (power));
===
which switches from fixed-length format (".1Lf") to variable length format
(".*Lf"),
and adds the variable "prec" to "snprintf".
Could it be that "prec" should come before "val" in the parameters?
If I test it with:
long double d;
int prec;
snprintf(buf,sizeof(buf),"%.*Lf\n",d,prec);
There's a compiler warning about incorrect types to snprintf.
There's no warning in numfmt because the format string is not hard-coded but
stored in variable 'fmt'.
WDYT?
thanks,
- assaf