diff options
author | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2015-05-30 07:02:48 +0200 |
---|---|---|
committer | Marco Bodrato <bodrato@mail.dm.unipi.it> | 2015-05-30 07:02:48 +0200 |
commit | d43ed1914cd3a9839c3ece0dc8f79a263b038eb2 (patch) | |
tree | 8ff773925b479c6184f81d90beb69b0e22d82afe /mpf | |
parent | 88271db0c2d8fd2ce2dc14f14a4064b1bb60a3cc (diff) | |
download | gmp-d43ed1914cd3a9839c3ece0dc8f79a263b038eb2.tar.gz |
mpf/sqrt_ui.c: Special case also for sqrt(1).
Diffstat (limited to 'mpf')
-rw-r--r-- | mpf/sqrt_ui.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/mpf/sqrt_ui.c b/mpf/sqrt_ui.c index 82dec7bcb..01c6f8920 100644 --- a/mpf/sqrt_ui.c +++ b/mpf/sqrt_ui.c @@ -75,16 +75,16 @@ mpf_sqrt_ui (mpf_ptr r, unsigned long int u) mp_size_t prec; TMP_DECL; - if (UNLIKELY (u == 0)) + if (UNLIKELY (u <= 1)) { - r->_mp_size = 0; - r->_mp_exp = 0; + SIZ (r) = EXP (r) = u; + *PTR (r) = u; return; } TMP_MARK; - prec = r->_mp_prec; + prec = PREC (r); zeros = 2 * prec - 2; rsize = zeros + 1 + U2; @@ -101,9 +101,9 @@ mpf_sqrt_ui (mpf_ptr r, unsigned long int u) } #endif - mpn_sqrtrem (r->_mp_d, NULL, tp, rsize); + mpn_sqrtrem (PTR (r), NULL, tp, rsize); - r->_mp_size = prec; - r->_mp_exp = 1; + SIZ (r) = prec; + EXP (r) = 1; TMP_FREE; } |