diff options
Diffstat (limited to 'Build/source/libs/mpfr/mpfr-src/src/mulders.c')
-rw-r--r-- | Build/source/libs/mpfr/mpfr-src/src/mulders.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Build/source/libs/mpfr/mpfr-src/src/mulders.c b/Build/source/libs/mpfr/mpfr-src/src/mulders.c index 8f23d21b678..a988db84bcb 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/mulders.c +++ b/Build/source/libs/mpfr/mpfr-src/src/mulders.c @@ -1,7 +1,7 @@ /* Mulders' MulHigh function (short product) -Copyright 2005-2015 Free Software Foundation, Inc. -Contributed by the AriC and Caramel projects, INRIA. +Copyright 2005-2016 Free Software Foundation, Inc. +Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -236,9 +236,10 @@ mpfr_divhigh_n_basecase (mpfr_limb_ptr qp, mpfr_limb_ptr np, that in addition to the limb np[n-1] to reduce, we have at least 2 extra limbs, thus accessing np[n-3] is valid. */ - /* warning: we can have np[n-1]=d1 and np[n-2]=d0, but since {np,n} < D, - the largest possible partial quotient is B-1 */ - if (MPFR_UNLIKELY(np[n - 1] == d1 && np[n - 2] == d0)) + /* Warning: we can have np[n-1]>d1 or (np[n-1]=d1 and np[n-2]>=d0) here, + since we truncate the divisor at each step, but since {np,n} < D + originally, the largest possible partial quotient is B-1. */ + if (MPFR_UNLIKELY(np[n-1] > d1 || (np[n-1] == d1 && np[n-2] >= d0))) q2 = ~ (mp_limb_t) 0; else udiv_qr_3by2 (q2, q1, q0, np[n - 1], np[n - 2], np[n - 3], |