summaryrefslogtreecommitdiff
path: root/src/set_d128.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-04-10 11:19:19 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-04-10 11:19:19 +0000
commit1ac2b1ca55ea54a7045c42c532f494b9f7e9bf24 (patch)
tree38c1ae86241cfcbf86fe47a3c8a58d23d4ad4470 /src/set_d128.c
parent9035cc7a9e134d55cf153464d2d8a8bf2f563b67 (diff)
downloadmpfr-1ac2b1ca55ea54a7045c42c532f494b9f7e9bf24.tar.gz
Reworked decimal support and detection, resolving FIXMEs.
* INSTALL, acinclude.m4, configure.ac: --enable-decimal-float can take new values. Change of macro DPD_FORMAT (DPD was assumed in case of cross-compilation, which could be wrong) to 3 new macros: DECIMAL_DPD_FORMAT, DECIMAL_BID_FORMAT, DECIMAL_GENERIC_CODE. * doc/README.dev: documented these 3 new macros. * src/mpfr-impl.h: the detection of the BID encoding can now be done at compile time when GCC defines __DECIMAL_BID_FORMAT__ (as on x86); support of the 3 new macros. * src/{get_d64.c,set_d64.c,set_d128.c}: update. * tests/{tget_set_d64.c,tget_set_d128.c,tversion.c}: update. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13878 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/set_d128.c')
-rw-r--r--src/set_d128.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/set_d128.c b/src/set_d128.c
index 9d2d904c2..abee67095 100644
--- a/src/set_d128.c
+++ b/src/set_d128.c
@@ -30,9 +30,11 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#ifdef MPFR_WANT_DECIMAL_FLOATS
-#if HAVE_DECIMAL128_IEEE && (GMP_NUMB_BITS == 32 || GMP_NUMB_BITS == 64)
+#if HAVE_DECIMAL128_IEEE && \
+ (GMP_NUMB_BITS == 32 || GMP_NUMB_BITS == 64) && \
+ !defined(DECIMAL_GENERIC_CODE)
-#ifdef DPD_FORMAT
+#ifdef DECIMAL_DPD_FORMAT
/* conversion 10-bits to 3 digits */
static unsigned int T[1024] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 80, 81, 800, 801, 880, 881, 10, 11, 12, 13,
@@ -129,9 +131,9 @@ decimal128_to_string (char *s, _Decimal128 d)
int Gh; /* most 5 significant bits from combination field */
int exp; /* exponent */
unsigned int i;
-#ifdef DPD_FORMAT
+#ifdef DECIMAL_DPD_FORMAT
unsigned int D[12]; /* declets */
-#else
+#else /* BID */
mp_limb_t rp[4];
mp_size_t rn;
#endif
@@ -163,7 +165,7 @@ decimal128_to_string (char *s, _Decimal128 d)
12 remaining bits)
* a trailing significand field of 110 bits
*/
-#ifdef DPD_FORMAT
+#ifdef DECIMAL_DPD_FORMAT
/* page 11 of IEEE 754-2008, case c1) */
if (Gh < 24)
{
@@ -246,8 +248,7 @@ decimal128_to_string (char *s, _Decimal128 d)
sprintf (t, "E%d", exp);
}
-#else
-/* portable version */
+#else /* portable version */
#ifndef DEC128_MAX
# define DEC128_MAX 9.999999999999999999999999999999999E6144dl
@@ -472,7 +473,7 @@ decimal128_to_string (char *s, _Decimal128 d)
*s = '\0';
}
-#endif /* _MPFR_IEEE_FLOATS */
+#endif /* definition of decimal128_to_string (DPD, BID, or portable) */
/* the IEEE754-2008 decimal128 format has 34 digits, with emax=6144,
emin=1-emax=-6143 */