summaryrefslogtreecommitdiff
path: root/tests/ttanu.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2021-01-12 21:49:18 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2021-01-12 21:49:18 +0000
commit8152adccfdc16e6b2f2f471e8ccfb9b8069a3063 (patch)
tree266d23dac1d55eb234180b2dcf4b7ee2f509b688 /tests/ttanu.c
parent1550a255fe20aa2570a8652bb36bfca20605b811 (diff)
downloadmpfr-8152adccfdc16e6b2f2f471e8ccfb9b8069a3063.tar.gz
[tests/{tcosu.c,tsinu.c,ttanu.c}] C90 compatibility for the tests with
large inputs (added in r14236). Also avoid the hardcoded size by using the numberof() macro. git-svn-id: https://scm.gforge.inria.fr/anonscm/svn/mpfr/trunk@14237 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/ttanu.c')
-rw-r--r--tests/ttanu.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/ttanu.c b/tests/ttanu.c
index 8e55c26d5..6220cc845 100644
--- a/tests/ttanu.c
+++ b/tests/ttanu.c
@@ -190,40 +190,40 @@ test_regular (void)
mpfr_clear (z);
}
-/* Check argument reduction with large hard-coded inputs. The following values were
- generated with gen_random(tan,10,53,100,20), where the Sage code for gen_random
- is given in the tcosu.c file */
+/* Check argument reduction with large hard-coded inputs. The following
+ values were generated with gen_random(tan,10,53,100,20), where the
+ Sage code for gen_random is given in the tcosu.c file. */
static void
test_large (void)
{
-#define SIZE 10
- static double T[SIZE][3] = {
- {-0x1.8f7cb49edc03p+16, 28, 0x4.c869fd8050554p-4},
- {-0xe.8ede30716292p+16, 17, -0x2.c83df69d8fdecp+4},
- {-0x8.f14a73a7b4a3p+16, 4, -0xd.be24a6d0fde98p-4},
- {0xe.f82c4537b473p+16, 93, -0x5.d0d95fdc8ffbcp+0},
- {0x8.4148f00c8418p+16, 50, 0x1.e4e4aa652b2a4p-4},
- {-0x6.e8b69db10e63p+16, 27, -0x2.4f32f1977b7b2p-4},
- {-0xe.a3ebf225ea2fp+16, 18, 0x6.5f7637f74517p+0},
- {-0x5.580eb29168d8p+16, 92, 0x8.96418eed84e8p+0},
- {0x8.13c5a1b43231p+16, 19, 0xb.2718b861b29fp-8},
- {0x4.eb4e546e042dp+16, 64, 0x6.0b3ba821e4ep+0}
+ static struct {
+ const char *x;
+ unsigned long u;
+ const char *y;
+ } t[] = {
+ { "-0x1.8f7cb49edc03p+16", 28, "0x4.c869fd8050554p-4" },
+ { "-0xe.8ede30716292p+16", 17, "-0x2.c83df69d8fdecp+4" },
+ { "-0x8.f14a73a7b4a3p+16", 4, "-0xd.be24a6d0fde98p-4" },
+ { "0xe.f82c4537b473p+16", 93, "-0x5.d0d95fdc8ffbcp+0" },
+ { "0x8.4148f00c8418p+16", 50, "0x1.e4e4aa652b2a4p-4" },
+ { "-0x6.e8b69db10e63p+16", 27, "-0x2.4f32f1977b7b2p-4" },
+ { "-0xe.a3ebf225ea2fp+16", 18, "0x6.5f7637f74517p+0" },
+ { "-0x5.580eb29168d8p+16", 92, "0x8.96418eed84e8p+0" },
+ { "0x8.13c5a1b43231p+16", 19, "0xb.2718b861b29fp-8" },
+ { "0x4.eb4e546e042dp+16", 64, "0x6.0b3ba821e4ep+0" }
};
int i;
- unsigned long u;
-
mpfr_t x, y, z;
- mpfr_inits2 (53, x, y, z, (mpfr_ptr) NULL);
- for (i = 0; i < SIZE; i++)
+
+ mpfr_inits2 (53, x, y, z, (mpfr_ptr) 0);
+ for (i = 0; i < numberof (t); i++)
{
- mpfr_set_d (x, T[i][0], MPFR_RNDN);
- u = (unsigned long) T[i][1];
- mpfr_set_d (y, T[i][2], MPFR_RNDN);
- mpfr_tanu (z, x, u, MPFR_RNDN);
+ mpfr_set_str (x, t[i].x, 0, MPFR_RNDN);
+ mpfr_set_str (y, t[i].y, 0, MPFR_RNDN);
+ mpfr_tanu (z, x, t[i].u, MPFR_RNDN);
MPFR_ASSERTN (mpfr_equal_p (y, z));
}
- mpfr_clears (x, y, z, (mpfr_ptr) NULL);
-#undef SIZE
+ mpfr_clears (x, y, z, (mpfr_ptr) 0);
}
/* FIXME[VL]: For mpfr_tanu, the range reduction should not be expensive.