summaryrefslogtreecommitdiff
path: root/libc/stdlib/gcvt.c
blob: f1c1f42709a5d8ac84e2bfeba2ef323f6d9083d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdio.h>
#include <stdlib.h>

libc_hidden_proto(sprintf)

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