summaryrefslogtreecommitdiff
path: root/libc/stdlib/gcvt.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-09-29 07:53:25 +0000
committerEric Andersen <andersen@codepoet.org>2001-09-29 07:53:25 +0000
commit087a6180190c5d1c597d06f763297716179d9574 (patch)
treef315ee3eab9ed3420fbb3160774b0617428d8ee7 /libc/stdlib/gcvt.c
parent78b5c6dad40a526777091ebb1d5b858eaa9a2cc8 (diff)
Add in gcvt()
Diffstat (limited to 'libc/stdlib/gcvt.c')
-rw-r--r--libc/stdlib/gcvt.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libc/stdlib/gcvt.c b/libc/stdlib/gcvt.c
new file mode 100644
index 000000000..4ce5cf4ee
--- /dev/null
+++ b/libc/stdlib/gcvt.c
@@ -0,0 +1,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