Skip to content
Snippets Groups Projects
Commit dd5fa3d3 authored by Luigi Scarso's avatar Luigi Scarso
Browse files

Fixed Update |arc| and |t_tot| after |do_arc_test| has just returned |t| in mp_get_arc_time

parent a7653fd5
Branches
No related tags found
No related merge requests found
......@@ -10353,14 +10353,20 @@ if (number_positive(arc)) {
new_number (v1);
 
set_number_from_substraction (d1, arc0, arc); /* d1 = arc0 - arc */
set_number_from_div (n1, arc, d1); /* n1 = (arc / d1) */
if (number_greater (d1,arc)) {
set_number_to_zero(n1); /* n1 = 0 */
} else {
set_number_from_div (n1, arc, d1); /* n1 = (arc / d1) */
floor_scaled(n1);
}
number_clone (n, n1);
set_number_from_mul (n1, n1, d1); /* n1 = (n1 * d1) */
number_substract (arc, n1); /* arc = arc - n1 */
 
number_clone (d1, inf_t); /* reuse d1 */
number_clone (v1, n); /* v1 = n */
number_add (v1, epsilon_t); /* v1 = n1+1 */
set_number_from_int(v1, number_to_int(v1)+1); /* v1 = n1+1 */
set_number_from_div (d1, d1, v1); /* |d1 = EL_GORDO / v1| */
if (number_greater (t_tot, d1)) {
mp->arith_error = true;
......@@ -1677,7 +1677,9 @@ void mp_init_randoms (MP mp, int seed) {
@ @c
void mp_binary_number_modulo (mp_number *a, mp_number b) {
mpfr_remainder (a->data.num, a->data.num, b.data.num, ROUNDING);
/* mpfr_remainder (a->data.num, a->data.num, b.data.num, ROUNDING);*/
/* This is consistent with scaled mode */
mpfr_fmod (a->data.num, a->data.num, b.data.num, ROUNDING);
}
@ To consume a random integer for the uniform generator, the program below will say `|next_unif_random|'.
......
......@@ -317,7 +317,9 @@ static int mpfi_remainder_1 (mpfi_t r, mpfi_t x, mpfr_t m) {
mpfr_inits2(precision_bits, d, abs_m, rem_a, rem_b, zero, one, abs_m_1,(mpfr_ptr) 0);
mpfr_sub(d, b, a, MPFR_RNDN);
mpfr_abs(abs_m, m, MPFR_RNDN);
mpfr_remainder(rem_a, a, m, MPFR_RNDN); mpfr_remainder(rem_b, b, m, MPFR_RNDN);
/*mpfr_remainder(rem_a, a, m, MPFR_RNDN); mpfr_remainder(rem_b, b, m, MPFR_RNDN); */
/* This is consistent with scaled mode */
mpfr_fmod(rem_a, a, m, MPFR_RNDN); mpfr_fmod(rem_b, b, m, MPFR_RNDN);
if (mpfr_less_p(d,abs_m) && mpfr_lessequal_p(rem_a,rem_b)) {
/*return [a % m, b % m] */
ret_val= mpfi_interv_fr(r, rem_a, rem_b);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment