diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-02-06 12:58:48 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2017-02-06 12:58:48 +0000 |
commit | 96dd59b90fc985162ed290d5788b52a032d65802 (patch) | |
tree | 99b373bb0827f51bacf96563ee6cff702fe7dd93 /src/sqr.c | |
parent | ef16a0e0c1c1e9f4240c8e8bad1e66e36e48c3b2 (diff) | |
download | mpfr-96dd59b90fc985162ed290d5788b52a032d65802.tar.gz |
[tests/tsqr.c] added a corner underflow case
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11258 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/sqr.c')
-rw-r--r-- | src/sqr.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -65,6 +65,14 @@ mpfr_sqr_1 (mpfr_ptr a, mpfr_srcptr b, mpfr_rnd_t rnd_mode, mpfr_prec_t p) a >= 0.111...111[1]*2^(emin-1), there is no underflow. */ if (MPFR_UNLIKELY(ax < __gmpfr_emin)) { + /* Note: for emin=2*k+1, a >= 0.111...111*2^(emin-1) is not possible, + i.e., a >= (1 - 2^(-p))*2^(2k), since we need a = b^2 with EXP(b)=k, + and the largest such b is (1 - 2^(-p))*2^k satisfies + b^2 < (1 - 2^(-p))*2^(2k). + For emin=2*k, it is only possible for some values of p: it is not + possible for p=53, because the largest significand is 6369051672525772 + but its square has only 52 leading ones. For p=24 it is possible, + with b = 11863283, whose square has 24 leading ones. */ if ((ax == __gmpfr_emin - 1) && (ap[0] == ~mask) && ((rnd_mode == MPFR_RNDN && rb) || (MPFR_IS_LIKE_RNDA(rnd_mode, MPFR_IS_NEG (a)) && (rb | sb)))) |