summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/floatio.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/floatio.h')
-rw-r--r--lib/libc/stdio/floatio.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/libc/stdio/floatio.h b/lib/libc/stdio/floatio.h
index a40df00..22fedcd 100644
--- a/lib/libc/stdio/floatio.h
+++ b/lib/libc/stdio/floatio.h
@@ -41,7 +41,14 @@
* Floating point scanf/printf (input/output) definitions.
*/
-/* 11-bit exponent (VAX G floating point) is 308 decimal digits */
-#define MAXEXP 308
-/* 128 bit fraction takes up 39 decimal digits; max reasonable precision */
-#define MAXFRACT 39
+/*
+ * MAXEXPDIG is the maximum number of decimal digits needed to store a
+ * floating point exponent in the largest supported format. It should
+ * be ceil(log10(LDBL_MAX_10_EXP)) or, if hexadecimal floating point
+ * conversions are supported, ceil(log10(LDBL_MAX_EXP)). But since it
+ * is presently never greater than 5 in practice, we fudge it.
+ */
+#define MAXEXPDIG 6
+#if LDBL_MAX_EXP > 999999
+#error "floating point buffers too small"
+#endif
OpenPOWER on IntegriCloud