summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/floatio.h
diff options
context:
space:
mode:
authorDavid Schultz <das@FreeBSD.org>2003-04-05 22:03:43 +0000
committerDavid Schultz <das@FreeBSD.org>2003-04-05 22:03:43 +0000
commit38cac8f88bdbc98152546e697f84e9015d972ff3 (patch)
tree826bf02ef4bdb923996387c17705464f14a5d35d /lib/libc/stdio/floatio.h
parentcdb06eda663a7fa638035a196634a688384fe79c (diff)
Notes
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 a40df0020bad..22fedcdd856a 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