CSRC = abort.c getenv.c mktemp.c qsort.c realpath.c abs.c bsearch.c \
mkstemp.c putenv.c rand.c random.c setenv.c system.c div.c ldiv.c \
- getpt.c ptsname.c grantpt.c unlockpt.c
+ getpt.c ptsname.c grantpt.c unlockpt.c gcvt.c
ifeq ($(HAS_FLOATING_POINT),true)
CSRC += strtod.c
endif
--- /dev/null
+
+#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