Re: [arm-gnu] sprintf issue on Cortex-M3
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] sprintf issue on Cortex-M3



On Tue, 15 Dec 2009 14:06:07 +0100
Norbert Unterberg <nunterberg@xxxxxxxxx> wrote:

> Hi,
> 
> we are using arm-none-eabi-gcc (Sourcery G++ Lite 2009q3-68) 4.4.1.
> 
> Formatting a floating point number with sprintf does not seem to work:
> 
>    char b[20];
>    float temperature = 0.4f;
>    sprintf(b, "%6.1f ", temperature);
> 
> prints "  -0.0" into the buffer.

Just a guess: make sure you've #include'd <stdio.h> so you have a
prototype for sprintf available, otherwise weird things are likely to
happen.

Julian