diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-03-04 14:24:49 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2020-03-04 14:24:49 +0000 |
commit | 7e81d527352667473dbda90b03bd4e6f0d105b8d (patch) | |
tree | eae503a3b9b37302b28169c82e2b2c265e8127eb | |
parent | a157d7932e6d9ea54a8f6dd0bb4561c62454aa17 (diff) | |
download | mpfr-7e81d527352667473dbda90b03bd4e6f0d105b8d.tar.gz |
[src/cmp2.c] Better explanation when |EXP(b) - EXP(c)| >= MPFR_EXP_MAX.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@13749 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | src/cmp2.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cmp2.c b/src/cmp2.c index 41e807f48..e73a5c01c 100644 --- a/src/cmp2.c +++ b/src/cmp2.c @@ -59,8 +59,10 @@ mpfr_cmp2 (mpfr_srcptr b, mpfr_srcptr c, mpfr_prec_t *cancel) /* The returned result is saturated to [MPFR_EXP_MIN,MPFR_EXP_MAX], which is the range of the mpfr_exp_t type. But under the condition below, since |MPFR_EXP_MIN| >= MPFR_EXP_MAX, the value of cancel - will not be affected: if saturation occurred, the smaller number - is less than the ulp of the larger number (in absolute value). */ + will not be affected: by symmetry (as done in the code), assume + |b| >= |c|; if |EXP(b) - EXP(c)| >= MPFR_EXP_MAX, then |c| < ulp(b), + so that the return value is 0, or 1 if |b| is a power of 2, whatever + the exact value of |EXP(b) - EXP(c)|. */ MPFR_STAT_STATIC_ASSERT (MPFR_EXP_MAX > MPFR_PREC_MAX); if (sdiff_exp >= 0) |