about summary refs log tree commit diff
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/efgcvt.c8
-rw-r--r--misc/efgcvt_r.c8
-rw-r--r--misc/qefgcvt.c10
-rw-r--r--misc/qefgcvt_r.c10
4 files changed, 32 insertions, 4 deletions
diff --git a/misc/efgcvt.c b/misc/efgcvt.c
index dc711c63dc..37b4bc0163 100644
--- a/misc/efgcvt.c
+++ b/misc/efgcvt.c
@@ -33,8 +33,14 @@
 # define MAXDIG (NDIGIT_MAX + 3)
 # if DBL_MANT_DIG == 53
 #  define NDIGIT_MAX 17
+# elif DBL_MANT_DIG == 24
+#  define NDIGIT_MAX 9
+# elif DBL_MANT_DIG == 56
+#  define NDIGIT_MAX 18
 # else
-/* See IEEE 854 5.6, table 2 for this formula.  */
+/* See IEEE 854 5.6, table 2 for this formula.  Unfortunately we need a
+   compile time constant here, so we cannot use it.  */
+#  error "NDIGIT_MAX must be precomputed"
 #  define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))
 # endif
 #endif
diff --git a/misc/efgcvt_r.c b/misc/efgcvt_r.c
index d73fd22f70..80770e6a82 100644
--- a/misc/efgcvt_r.c
+++ b/misc/efgcvt_r.c
@@ -32,8 +32,14 @@
 # define FLOAT_NAME_EXT
 # if DBL_MANT_DIG == 53
 #  define NDIGIT_MAX 17
+# elif DBL_MANT_DIG == 24
+#  define NDIGIT_MAX 9
+# elif DBL_MANT_DIG == 56
+#  define NDIGIT_MAX 18
 # else
-/* See IEEE 854 5.6, table 2 for this formula.  */
+/* See IEEE 854 5.6, table 2 for this formula.  Unfortunately we need a
+   compile time constant here, so we cannot use it.  */
+#  error "NDIGIT_MAX must be precomputed"
 #  define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * DBL_MANT_DIG + 1.0)))
 # endif
 #endif
diff --git a/misc/qefgcvt.c b/misc/qefgcvt.c
index faf788aa5d..63fc764121 100644
--- a/misc/qefgcvt.c
+++ b/misc/qefgcvt.c
@@ -28,8 +28,16 @@
 #define MAXDIG (NDIGIT_MAX + 12)
 #if LDBL_MANT_DIG == 64
 # define NDIGIT_MAX 21
+#elif LDBL_MANT_DIG == 53
+# define NDIGIT_MAX 17
+#elif LDBL_MANT_DIG == 113
+# define NDIGIT_MAX 36
+#elif LDBL_MANT_DIG == 56
+# define NDIGIT_MAX 18
 #else
-/* See IEEE 854 5.6, table 2 for this formula.  */
+/* See IEEE 854 5.6, table 2 for this formula.  Unfortunately we need a
+   compile time constant here, so we cannot use it.  */
+# error "NDIGIT_MAX must be precomputed"
 # define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
 #endif
 
diff --git a/misc/qefgcvt_r.c b/misc/qefgcvt_r.c
index 5ff8110e3b..040193b612 100644
--- a/misc/qefgcvt_r.c
+++ b/misc/qefgcvt_r.c
@@ -26,8 +26,16 @@
 #define FLOAT_NAME_EXT l
 #if LDBL_MANT_DIG == 64
 # define NDIGIT_MAX 21
+#elif LDBL_MANT_DIG == 53
+# define NDIGIT_MAX 17
+#elif LDBL_MANT_DIG == 113
+# define NDIGIT_MAX 36
+#elif LDBL_MANT_DIG == 56
+# define NDIGIT_MAX 18
 #else
-/* See IEEE 854 5.6, table 2 for this formula.  */
+/* See IEEE 854 5.6, table 2 for this formula.  Unfortunately we need a
+   compile time constant here, so we cannot use it.  */
+# error "NDIGIT_MAX must be precomputed"
 # define NDIGIT_MAX (lrint (ceil (M_LN2 / M_LN10 * LDBL_MANT_DIG + 1.0)))
 #endif