2016-04-26 17:20:05 +02:00
|
|
|
/*
|
2013-06-09 19:53:01 +02:00
|
|
|
Copyright (C) 2013 Fredrik Johansson
|
|
|
|
|
2016-04-26 17:20:05 +02:00
|
|
|
This file is part of Arb.
|
|
|
|
|
|
|
|
Arb is free software: you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU Lesser General Public License (LGPL) as published
|
|
|
|
by the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version. See <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2013-06-09 19:53:01 +02:00
|
|
|
|
|
|
|
#include "fmpr.h"
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2015-11-05 18:03:08 +00:00
|
|
|
slong iter;
|
2013-06-09 19:53:01 +02:00
|
|
|
flint_rand_t state;
|
|
|
|
|
2015-11-06 16:17:27 +00:00
|
|
|
flint_printf("divappr_abs_ubound....");
|
2013-06-09 19:53:01 +02:00
|
|
|
fflush(stdout);
|
|
|
|
|
|
|
|
flint_randinit(state);
|
|
|
|
|
2016-04-10 17:24:58 +02:00
|
|
|
for (iter = 0; iter < 10000 * arb_test_multiplier(); iter++)
|
2013-06-09 19:53:01 +02:00
|
|
|
{
|
|
|
|
fmpr_t a, b, c, d;
|
2015-11-05 18:03:08 +00:00
|
|
|
slong prec;
|
2013-06-09 19:53:01 +02:00
|
|
|
|
|
|
|
fmpr_init(a);
|
|
|
|
fmpr_init(b);
|
|
|
|
fmpr_init(c);
|
|
|
|
fmpr_init(d);
|
|
|
|
|
|
|
|
fmpr_randtest_special(a, state, 2 + n_randint(state, 200), 100);
|
|
|
|
fmpr_randtest_special(b, state, 2 + n_randint(state, 200), 100);
|
|
|
|
fmpr_randtest_special(c, state, 2 + n_randint(state, 200), 100);
|
|
|
|
fmpr_randtest_special(d, state, 2 + n_randint(state, 200), 100);
|
|
|
|
prec = 2 + n_randint(state, 200);
|
|
|
|
|
|
|
|
fmpr_div(c, a, b, prec, FMPR_RND_UP);
|
|
|
|
fmpr_abs(c, c);
|
|
|
|
|
|
|
|
fmpr_divappr_abs_ubound(d, a, b, prec);
|
|
|
|
|
|
|
|
if (fmpr_cmp(c, d) > 0)
|
|
|
|
{
|
2015-11-06 16:17:27 +00:00
|
|
|
flint_printf("FAIL:\n");
|
|
|
|
fmpr_printd(a, prec / 3.32); flint_printf("\n");
|
|
|
|
fmpr_printd(b, prec / 3.32); flint_printf("\n");
|
|
|
|
fmpr_printd(c, prec / 3.32); flint_printf("\n");
|
|
|
|
fmpr_printd(d, prec / 3.32); flint_printf("\n");
|
2017-02-28 16:50:03 +01:00
|
|
|
flint_abort();
|
2013-06-09 19:53:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fmpr_clear(a);
|
|
|
|
fmpr_clear(b);
|
|
|
|
fmpr_clear(c);
|
|
|
|
fmpr_clear(d);
|
|
|
|
}
|
|
|
|
|
|
|
|
flint_randclear(state);
|
2013-07-30 13:53:10 +02:00
|
|
|
flint_cleanup();
|
2015-11-06 16:17:27 +00:00
|
|
|
flint_printf("PASS\n");
|
2013-06-09 19:53:01 +02:00
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|