NewLib nano fprintf_float uppercase format
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Arm Embedded Toolchain |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Hi, I try to format double value with useing linker key :
--specs=nano.specs -u _printf_float
If I use like this:
snprintf(buf, bufLen, fullLen, "%s%.*F", p, accuracy, value)
or that
snprintf(buf, bufLen, fullLen, "%s%.4F", p, value)
the snpintf function behaves incorrectly but if I use
snprintf(buf, bufLen, fullLen, "%s%F", p, value)
or
snprintf(buf, bufLen, fullLen, "%s%.4f", p, value)
it`s ok.
This bug I found in gcc version 4.9.3 20150303 (release) [ARM/embedded-
GNU Tools for ARM Embedded Processors)
I looked in file nano-vfpintf_
in line number 239 looks like this
if (code == 'g' || code == 'G')
{
if (expt <= -4 || expt > pdata->prec)
/* 'e' or 'E'. */
code -= 2;
else
code = 'g';
}
...
but in line number 258 compare is present only for small 'f' char
if (code == 'f')
{
/* 'f' fmt. */
if (expt > 0)
{
pdata->size = expt;
if (pdata->prec || pdata->flags & ALT)
pdata->size += pdata->prec + 1;
}
else
/* "0.X". */
pdata->size = (pdata->prec || pdata->flags & ALT)
? pdata->prec + 2 : 1;
}
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Hi Anfrid,
the 'F' specifier was introduced as part of C99 and nano targets C89 printf in order to save space. If you need the F specifier you will have to use newlib.
Best regards.