summaryrefslogtreecommitdiff
path: root/stdlib/stdlib.h
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2016-06-28 17:30:42 -0300
committerGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>2016-10-25 17:03:54 -0200
commit6962682ffe5e5f0373047a0b894fee7a774be254 (patch)
treee8e3660cf706a62dc9c71972aa2acf165caf5c48 /stdlib/stdlib.h
parent78b7adbaea643f2f213bb113e3ec933416a769a8 (diff)
Add strfromd, strfromf, and strfroml functions
ISO/IEC TS 18661-1 adds several functions in the strfrom family to stdlib. This patch adds strfromd, strfromf, and strfroml. This is being done in preparation for the new floating-point type, float128. The added functions convert a floating-point value into a string, with configurable format.
Diffstat (limited to 'stdlib/stdlib.h')
-rw-r--r--stdlib/stdlib.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index f0dc951acf..48f9a9500e 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -21,7 +21,8 @@
#ifndef _STDLIB_H
-#include <features.h>
+#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
+#include <bits/libc-header-start.h>
/* Get size_t, wchar_t and NULL from <stddef.h>. */
#define __need_size_t
@@ -178,6 +179,21 @@ extern unsigned long long int strtoull (const char *__restrict __nptr,
__END_NAMESPACE_C99
#endif /* ISO C99 or use MISC. */
+/* Convert a floating-point number to a string. */
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
+extern int strfromd (char *__dest, size_t __size, const char *__format,
+ double __f)
+ __THROW __nonnull ((3));
+
+extern int strfromf (char *__dest, size_t __size, const char *__format,
+ float __f)
+ __THROW __nonnull ((3));
+
+extern int strfroml (char *__dest, size_t __size, const char *__format,
+ long double __f)
+ __THROW __nonnull ((3));
+#endif
+
#ifdef __USE_GNU
/* The concept of one static locale per category is not very well