Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned char* print_float(unsigned char* str, unsigned int nb, int nb_deci)
- {
- int i=1, j=0, x, base = 10;
- for(x=nb;x;x/=base) j++;
- j++;
- for(x=nb;x;x/=base)
- {
- str[j-i++] = x%base + '0';
- if(i-1 == nb_deci)
- {
- str[j-i++] = '.';
- }
- }
- str[j] = 0;
- return str;
- }
Advertisement
Add Comment
Please, Sign In to add comment