Float formatting bug in Printout and Sprintf libraries

General discussion on mikroC PRO for ARM.
Post Reply
Author
Message
Dr.AMS
Posts: 6
Joined: 22 Aug 2020 01:21

Float formatting bug in Printout and Sprintf libraries

#1 Post by Dr.AMS » 19 Dec 2020 03:24

Hi Everyone,
I hope you are all heading to have a great Christmas and Holidays. I am seeing a very strange behaviour (using STM32L462CE) with Printout and Sprintf Libraries they both will give widely wrong output for float values if they are formatted as %f it seems to be almost always +1 for some parameters. It is also intermittent is not always happing I have tried double and long double but they are giving the same error . Even reading ADC and converting to voltage will cause a problem. if you change to %e or %E you get the correct value. Can anyone help with this issue.

Code: Select all

Battery_Voltage=(float) Battery_Voltage_Raw*3.3f/1024.0f;
PrintOut(PrintHandler,"Value=%f\n",Battery_Voltage);


User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Float formatting bug in Printout and Sprintf libraries

#2 Post by filip » 22 Jan 2021 08:31

Hi,

Can you please attach the minimal project that demonstrates this issue ?

Regards,
Filip.

Post Reply

Return to “mikroC PRO for ARM General”