summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2020-01-08 12:15:52 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2020-01-08 12:15:52 +0000
commit7ae2b729731d61abd37fad5031977e19151ab93f (patch)
treead6b7a2625693beef95c378836935bfb6519d244 /tests
parent8fd1b5e37fa71ded258b38c3168ad4e5b18e89f5 (diff)
downloadmpfr-7ae2b729731d61abd37fad5031977e19151ab93f.tar.gz
fixed tests for new more precise semantics for mpfr_printf ("%Re", x),
and documented it git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13644 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r--tests/tfprintf.c12
-rw-r--r--tests/tprintf.c4
-rw-r--r--tests/tsprintf.c22
3 files changed, 19 insertions, 19 deletions
diff --git a/tests/tfprintf.c b/tests/tfprintf.c
index f8a0afd6d..2cb94dff0 100644
--- a/tests/tfprintf.c
+++ b/tests/tfprintf.c
@@ -195,7 +195,7 @@ check_mixed (FILE *fout)
lo, &ulo);
check_length (2, ulo, 36, lu);
check_vfprintf (fout, "a. %hi, b. %*f, c. %Re%hn", ush, 3, f, mpfr, &ush);
- check_length (3, ush, 29, hu);
+ check_length (3, ush, 46, hu);
check_vfprintf (fout, "a. %hi, b. %f, c. %#.2Rf%n", sh, d, mpfr, &i);
check_length (4, i, 29, d);
check_vfprintf (fout, "a. %R*A, b. %Fe, c. %i%zn", rnd, mpfr, mpf, sz,
@@ -233,12 +233,12 @@ check_mixed (FILE *fout)
#if (__GNU_MP_VERSION * 10 + __GNU_MP_VERSION_MINOR) >= 42
/* The 'M' specifier was added in gmp 4.2.0 */
check_vfprintf (fout, "a. %Mx b. %Re%Mn", limb[0], mpfr, &limb[0]);
- if (limb[0] != 14 + GMP_NUMB_BITS / 4 ||
+ if (limb[0] != 29 + GMP_NUMB_BITS / 4 ||
limb[1] != MPFR_LIMB_MAX ||
limb[2] != MPFR_LIMB_MAX)
{
printf ("Error in test #11: mpfr_vfprintf did not print %d characters"
- " as expected\n", 14 + (int) GMP_NUMB_BITS / 4);
+ " as expected\n", 29 + (int) GMP_NUMB_BITS / 4);
exit (1);
}
@@ -247,12 +247,12 @@ check_mixed (FILE *fout)
and check it doesn't go through */
check_vfprintf (fout, "a. %Re .b %Nx%Nn", mpfr, limb, limb_size, limb,
limb_size - 1);
- if (limb[0] != 14 + 3 * GMP_NUMB_BITS / 4 ||
+ if (limb[0] != 29 + 3 * GMP_NUMB_BITS / 4 ||
limb[1] != MPFR_LIMB_ZERO ||
limb[2] != MPFR_LIMB_MAX)
{
printf ("Error in test #12: mpfr_vfprintf did not print %d characters"
- " as expected\n", 14 + (int) GMP_NUMB_BITS / 4);
+ " as expected\n", 29 + (int) GMP_NUMB_BITS / 4);
exit (1);
}
#endif
@@ -263,7 +263,7 @@ check_mixed (FILE *fout)
unsigned long long ullo = 1;
check_vfprintf (fout, "a. %Re, b. %llx%Qn", mpfr, ullo, &mpq);
- check_length_with_cmp (21, mpq, 16, mpq_cmp_ui (mpq, 16, 1), Qu);
+ check_length_with_cmp (21, mpq, 31, mpq_cmp_ui (mpq, 31, 1), Qu);
check_vfprintf (fout, "a. %lli, b. %Rf%Fn", llo, mpfr, &mpf);
check_length_with_cmp (22, mpf, 19, mpf_cmp_ui (mpf, 19), Fg);
}
diff --git a/tests/tprintf.c b/tests/tprintf.c
index 734419f02..652c1e80b 100644
--- a/tests/tprintf.c
+++ b/tests/tprintf.c
@@ -316,7 +316,7 @@ check_mixed (void)
check_vprintf ("a. %c, b. %Rb, c. %u, d. %li%ln", i, mpfr, i, lo, &ulo);
check_length (2, ulo, 36, lu);
check_vprintf ("a. %hi, b. %*f, c. %Re%hn", ush, 3, f, mpfr, &ush);
- check_length (3, ush, 29, hu);
+ check_length (3, ush, 46, hu);
check_vprintf ("a. %hi, b. %f, c. %#.2Rf%n", sh, d, mpfr, &i);
check_length (4, i, 29, d);
check_vprintf ("a. %R*A, b. %Fe, c. %i%zn", rnd, mpfr, mpf, sz, &sz);
@@ -356,7 +356,7 @@ check_mixed (void)
unsigned long long ullo = 1;
check_vprintf ("a. %Re, b. %llx%Qn", mpfr, ullo, &mpq);
- check_length_with_cmp (11, mpq, 16, mpq_cmp_ui (mpq, 16, 1), Qu);
+ check_length_with_cmp (11, mpq, 31, mpq_cmp_ui (mpq, 31, 1), Qu);
check_vprintf ("a. %lli, b. %Rf%lln", llo, mpfr, &ullo);
check_length (12, ullo, 19, llu);
}
diff --git a/tests/tsprintf.c b/tests/tsprintf.c
index 6f0abdacb..41a071090 100644
--- a/tests/tsprintf.c
+++ b/tests/tsprintf.c
@@ -303,7 +303,7 @@ decimal (void)
mpfr_set_ui (z, 0, MPFR_RNDD);
/* simplest case right justified */
- check_sprintf (" 1.899347461279296875e+07", "%30Re", x);
+ check_sprintf ("1.899347461279296875000000000000000000000e+07", "%30Re", x);
check_sprintf (" 2e+07", "%30.0Re", x);
check_sprintf (" 18993474.612793", "%30Rf", x);
check_sprintf (" 18993474.6127930", "%30.7Rf", x);
@@ -316,13 +316,13 @@ decimal (void)
check_sprintf (" 0", "%30.0Rg", z);
check_sprintf (" 0", "%30.4Rg", z);
/* sign or space, pad with leading zeros */
- check_sprintf (" 000001.899347461279296875E+07", "% 030RE", x);
+ check_sprintf (" 1.899347461279296875000000000000000000000E+07", "% 030RE", x);
check_sprintf (" 0000000000000000001.89935E+07", "% 030RG", x);
check_sprintf (" 0000000000000000000000002E+07", "% 030.0RE", x);
check_sprintf (" 0000000000000000000000000E+00", "% 030.0RE", z);
check_sprintf (" 00000000000000000000000000000", "% 030.0RF", z);
/* sign + or -, left justified */
- check_sprintf ("+1.899347461279296875e+07 ", "%+-30Re", x);
+ check_sprintf ("+1.899347461279296875000000000000000000000e+07", "%+-30Re", x);
check_sprintf ("+2e+07 ", "%+-30.0Re", x);
check_sprintf ("+0e+00 ", "%+-30.0Re", z);
check_sprintf ("+0 ", "%+-30.0Rf", z);
@@ -342,7 +342,7 @@ decimal (void)
check_sprintf ("+0000.0E+00", "%0+#11.1RZE", z);
check_sprintf ("+00000000.0", "%0+#11.1RZF", z);
/* pad with leading zero */
- check_sprintf ("0000001.899347461279296875e+07", "%030RDe", x);
+ check_sprintf ("1.899347461279296875000000000000000000000e+07", "%030RDe", x);
check_sprintf ("00000000000000000000000001e+07", "%030.0RDe", x);
/* sign or space, decimal point, left justified */
check_sprintf (" 1.8E+07 ", "%- #11.1RDE", x);
@@ -363,8 +363,8 @@ decimal (void)
/* neighborhood of 1 */
mpfr_set_str (x, "0.99993896484375", 10, MPFR_RNDN);
- check_sprintf ("9.9993896484375E-01 ", "%-20RE", x);
- check_sprintf ("9.9993896484375E-01 ", "%-20.RE", x);
+ check_sprintf ("9.999389648437500000000000000000000000000E-01", "%-20RE", x);
+ check_sprintf ("9.999389648437500000000000000000000000000E-01", "%-20.RE", x);
check_sprintf ("1E+00 ", "%-20.0RE", x);
check_sprintf ("1.0E+00 ", "%-20.1RE", x);
check_sprintf ("1.00E+00 ", "%-20.2RE", x);
@@ -399,7 +399,7 @@ decimal (void)
/* powers of 10 */
mpfr_set_str (x, "1e17", 10, MPFR_RNDN);
- check_sprintf ("1e+17", "%Re", x);
+ check_sprintf ("1.000000000000000000000000000000000000000e+17", "%Re", x);
check_sprintf ("1.000e+17", "%.3Re", x);
check_sprintf ("100000000000000000", "%.0Rf", x);
check_sprintf ("100000000000000000.0", "%.1Rf", x);
@@ -407,7 +407,7 @@ decimal (void)
check_sprintf ("100000000000000000.0", "%'.1Rf", x);
mpfr_ui_div (x, 1, x, MPFR_RNDN); /* x=1e-17 */
- check_sprintf ("1e-17", "%Re", x);
+ check_sprintf ("1.000000000000000000000000000000000000000e-17", "%Re", x);
check_sprintf ("0.000000", "%Rf", x);
check_sprintf ("1e-17", "%Rg", x);
check_sprintf ("0.0", "%.1RDf", x);
@@ -849,9 +849,9 @@ mixed (void)
rnd = MPFR_RNDD;
check_vsprintf ("121%", "%i%%", i);
- check_vsprintf ("121% -1.2345678875E+07", "%i%% %RNE", i, x);
+ check_vsprintf ("121% -1.2345678875000000E+07", "%i%% %RNE", i, x);
check_vsprintf ("121, -12345679", "%i, %.0Rf", i, x);
- check_vsprintf ("10610209857723, -1.2345678875e+07", "%Zi, %R*e", mpz, rnd,
+ check_vsprintf ("10610209857723, -1.2345678875000000e+07", "%Zi, %R*e", mpz, rnd,
x);
check_vsprintf ("-12345678.9, 121", "%.1Rf, %i", x, i);
check_vsprintf ("-12345678, 1e240/45b352", "%.0R*f, %Qx", MPFR_RNDZ, x, mpq);
@@ -880,7 +880,7 @@ mixed (void)
#ifdef PRINTF_L
/* under MinGW, -D__USE_MINGW_ANSI_STDIO is required to support %Lf
see https://gcc.gnu.org/ml/gcc/2013-03/msg00103.html */
- check_vsprintf ("00000010610209857723, -1.2345678875e+07, 0.032258",
+ check_vsprintf ("00000010610209857723, -1.2345678875000000e+07, 0.032258",
"%.*Zi, %R*e, %Lf", 20, mpz, rnd, x, d);
#endif