summaryrefslogtreecommitdiff
path: root/libc/stdlib/gcvt.c
blob: 4ce5cf4ee9a948070884fdc59b9a5ff07903c74b (plain)
1
2
3
4
5
6
7
8
9
10
11

#include <stdlib.h>

#ifdef __UCLIBC_HAS_FLOATS__
#define MAX_NDIGIT 17
char * gcvt(double number, size_t ndigit, char* buf)
{
    sprintf(buf, "%.*g", (ndigit > MAX_NDIGIT)? MAX_NDIGIT : ndigit, number);
    return buf;
}
#endif