summaryrefslogtreecommitdiff
path: root/tests/tsub1sp.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tsub1sp.c')
-rw-r--r--tests/tsub1sp.c136
1 files changed, 68 insertions, 68 deletions
diff --git a/tests/tsub1sp.c b/tests/tsub1sp.c
index 1dcc476be..f717cd720 100644
--- a/tests/tsub1sp.c
+++ b/tests/tsub1sp.c
@@ -44,7 +44,7 @@ int main(void)
#define STD_ERROR \
{\
printf("ERROR: for %s and p=%lu and i=%d:\nY=",\
- mpfr_print_rnd_mode(r), p, i);\
+ mpfr_print_rnd_mode ((mp_rnd_t) r), p, i);\
mpfr_print_binary(y);\
printf("\nZ="); mpfr_print_binary(z);\
printf("\nReal: "); mpfr_print_binary(x2);\
@@ -56,7 +56,7 @@ int main(void)
#define STD_ERROR2 \
{\
printf("ERROR: for %s and p=%lu and i=%d:\nY=",\
- mpfr_print_rnd_mode(r), p, i);\
+ mpfr_print_rnd_mode ((mp_rnd_t) r), p, i);\
mpfr_print_binary(y);\
printf("\nZ="); mpfr_print_binary(z);\
printf("\nR="); mpfr_print_binary(x);\
@@ -68,7 +68,7 @@ int main(void)
void check_random(mpfr_prec_t p)
{
mpfr_t x,y,z,x2;
- mp_rnd_t r;
+ int r;
int i, inexact1, inexact2;
mpfr_inits2(p, x,y,z,x2,NULL);
@@ -80,8 +80,8 @@ void check_random(mpfr_prec_t p)
if (MPFR_IS_PURE_FP(y) && MPFR_IS_PURE_FP(z))
for(r = 0 ; r < GMP_RND_MAX ; r++)
{
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -95,7 +95,7 @@ void check_random(mpfr_prec_t p)
void check_special(void)
{
mpfr_t x,y,z,x2;
- mp_rnd_t r;
+ int r;
mpfr_prec_t p;
int i = -1, inexact1, inexact2;
mp_exp_t es;
@@ -113,7 +113,7 @@ void check_special(void)
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011000001101101011011001E31");
- mpfr_sub1sp(x, y, y, r);
+ mpfr_sub1sp (x, y, y, (mp_rnd_t) r);
if (mpfr_cmp_ui(x, 0))
{
printf("Error for x-x with p=%lu. Expected 0. Got:", p);
@@ -121,8 +121,8 @@ void check_special(void)
exit(1);
}
- mpfr_set(z, y, r);
- mpfr_sub1sp(x, y, z, r);
+ mpfr_set(z, y, (mp_rnd_t) r);
+ mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp_ui(x, 0))
{
printf("Error for x-y with y=x and p=%lu. Expected 0. Got:", p);
@@ -132,8 +132,8 @@ void check_special(void)
/* diff = 0 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011001001101101011011001E31");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -142,8 +142,8 @@ void check_special(void)
/* Diff = 1 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011000001101101011011001E30");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -152,8 +152,8 @@ void check_special(void)
/* Diff = 2 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011000101101101011011001E32");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -162,8 +162,8 @@ void check_special(void)
/* Diff = 32 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011000001101101011011001E63");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -172,8 +172,8 @@ void check_special(void)
/* Diff = 52 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011010001101101011011001E83");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -182,8 +182,8 @@ void check_special(void)
/* Diff = 53 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011111000001101101011011001E31");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -192,8 +192,8 @@ void check_special(void)
/* Diff > 200 */
mpfr_set_str_binary (y,
"0.10110111101101110010010010011011000001101101011011001E331");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -203,8 +203,8 @@ void check_special(void)
"0.10000000000000000000000000000000000000000000000000000E31");
mpfr_set_str_binary (z,
"0.11111111111111111111111111111111111111111111111111111E30");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -214,8 +214,8 @@ void check_special(void)
"0.10000000000000000000000000000000000000000000000000000E31");
mpfr_set_str_binary (z,
"0.11111111111111111111111111111111111111111111111111111E29");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -225,8 +225,8 @@ void check_special(void)
"0.10000000000000000000000000000000000000000000000000000E52");
mpfr_set_str_binary (z,
"0.10000000000010000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -236,9 +236,9 @@ void check_special(void)
"0.11100000000000000000000000000000000000000000000000000E53");
mpfr_set_str_binary (z,
"0.10000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(z, y, z, r);
- mpfr_set(x, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(z, y, z, (mp_rnd_t) r);
+ mpfr_set(x, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -248,8 +248,8 @@ void check_special(void)
"0.10000000000000000000000000000000000000000000000000000E53");
mpfr_set_str_binary (z,
"0.10100000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -259,8 +259,8 @@ void check_special(void)
"0.10000000000000000000000000000000000000000000000000000E54");
mpfr_set_str_binary (z,
"0.10100000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -275,8 +275,8 @@ void check_special(void)
"0.100000000000000000000000000000000000000000000000000000000000000E62");
mpfr_set_str_binary (z,
"0.110000000000000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -292,8 +292,8 @@ void check_special(void)
"0.1100000000000000000000000000000000000000000000000000000000000000E31");
mpfr_set_str_binary (z,
"0.1111111111111111111111111110000000000000000000000000011111111111E29");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -303,8 +303,8 @@ void check_special(void)
"0.1000000000000000000000000000000000000000000000000000000000000000E63");
mpfr_set_str_binary (z,
"0.1011000000000000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -314,8 +314,8 @@ void check_special(void)
"0.1000000000000000000000000000000000000000000000000000000000000000E63");
mpfr_set_str_binary (z,
"0.1110000000000000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -325,8 +325,8 @@ void check_special(void)
"0.10000000000000000000000000000000000000000000000000000000000000E63");
mpfr_set_str_binary (z,
"0.10000000000000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -336,8 +336,8 @@ void check_special(void)
"0.1000000000000000000000000000000000000000000000000000000000000000E64");
mpfr_set_str_binary (z,
"0.1010000000000000000000000000000000000000000000000000000000000000E00");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -351,8 +351,8 @@ void check_special(void)
mpfr_set_str_binary (z,
"0.1100000000000000000000000000000000000000000000000000000000000000"
"E-1073741823");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -366,8 +366,8 @@ void check_special(void)
mpfr_set_str_binary (y, "0.100000000E1");
mpfr_set_str_binary (z, "0.100000000E-8");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -381,8 +381,8 @@ void check_special(void)
mpfr_set_str_binary (y, "-0.1011110000111100010111011100110100E-18");
mpfr_set_str_binary (z, "0.1000101010110011010101011110000000E-14");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -398,8 +398,8 @@ void check_special(void)
"0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E1");
mpfr_set_str_binary (z,
"0.1011111000100111000011001000011101010101101100101010101001000001110100001101110110001110111010000011101001100010111110001100E-31");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -415,8 +415,8 @@ void check_special(void)
"0.111000110011000001000111101010111011110011101001101111111110000011100101000001001010110010101010011001010100000001110011110001010101101010001011101110100100001011110100110000101101100011010001001011011010101010000010001101001000110010010111111011110001111101001000101101001100101100101000E80");
mpfr_set_str_binary (z,
"-0.100001111111101001011010001100110010100111001110000110011101001011010100001000000100111011010110110010000000000010101101011000010000110001110010100001100101011100100100001011000100011110000001010101000100011101001000010111100000111000111011001000100100011000100000010010111000000100100111E-258");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -432,8 +432,8 @@ void check_special(void)
"0.1111101110100110110110100010101011101001100010100011110110110010010011101100101111100E-4");
mpfr_set_str_binary (z,
"0.1111101110100110110110100010101001001000011000111000011101100101110100001110101010110E-4");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -449,8 +449,8 @@ void check_special(void)
mpfr_set_str_binary (z,
"0.10000000000000000000000000000000"
"00000000000000000000000000000001E0");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -462,8 +462,8 @@ void check_special(void)
mpfr_set_str_binary (z,
"0.10000000000000000000000000000000"
"00000000000000000000000000000001E0");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -478,8 +478,8 @@ void check_special(void)
mpfr_set_str_binary (z,
"0.10000000000000000000000000000000"
"00000000000000000000000000000001E-1023");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)
@@ -491,8 +491,8 @@ void check_special(void)
mpfr_set_str_binary (z,
"0.1000000000000000000000000000000"
"000000000000000000000000000000E-1023");
- inexact1 = mpfr_sub1(x2, y, z, r);
- inexact2 = mpfr_sub1sp(x, y, z, r);
+ inexact1 = mpfr_sub1(x2, y, z, (mp_rnd_t) r);
+ inexact2 = mpfr_sub1sp(x, y, z, (mp_rnd_t) r);
if (mpfr_cmp(x, x2))
STD_ERROR;
if (inexact1 != inexact2)