Eric_O
Advanced Member level 4
Here under the beginning of my routine that runs …
void float2ascii_v3_2 (float f, unsigned char *buf, char decimal) // Converts a floating point number to an ASCII string.
{ //
unsigned int remainder;
unsigned char *s, length; // unsigned char *s is the pointer to the string
long i;
char j;
length = 0;
j = 0;
i = (long)((float)f * pow(10, decimal)); // float type is from 3,4 x 10 -38 to 3,4 x 10 38
…
But …
When I run the routine step by step, with MikroC Debbuger in order to monitor variables and checking loops conditions … when decimal = 3, f = 1234,567, the Debbuger shows f = 1,234567EXP003 (ok) and i = 1234565, instead of 1234567.
Why ?
Merci.
Éric
void float2ascii_v3_2 (float f, unsigned char *buf, char decimal) // Converts a floating point number to an ASCII string.
{ //
unsigned int remainder;
unsigned char *s, length; // unsigned char *s is the pointer to the string
long i;
char j;
length = 0;
j = 0;
i = (long)((float)f * pow(10, decimal)); // float type is from 3,4 x 10 -38 to 3,4 x 10 38
…
But …
When I run the routine step by step, with MikroC Debbuger in order to monitor variables and checking loops conditions … when decimal = 3, f = 1234,567, the Debbuger shows f = 1,234567EXP003 (ok) and i = 1234565, instead of 1234567.
Why ?
Merci.
Éric