diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2008-08-11 08:09:14 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2008-08-11 08:09:14 +0000 |
commit | 985b630fe5ed82efc6376652cecd82552031d8f3 (patch) | |
tree | 10d2442c33ad9867c038dbc25015894c8e059489 /mpfr-impl.h | |
parent | 6851316430ab3b8c175175ad8d4c179d051d7c8f (diff) | |
download | mpfr-985b630fe5ed82efc6376652cecd82552031d8f3.tar.gz |
Merged vlefevre branch:
svn merge -c-5445 .
svn merge -r5436:HEAD .../mpfr/branches/vlefevre
* pow.c:
- Moved the general case from mpfr_pow() to a new internal function
mpfr_pow_general().
- In this function (from old code), avoid unnecessary overflow test
if the intermediate result is not an infinity (which was the case
of underflow with non-zero result, thus not an overflow).
- Fixed a double-rounding problem that occurred in this function in
some underflow cases when rescaling the result.
- Added log messages.
* mpfr-impl.h: added mpfr_pow_general prototype.
* pow_z.c:
- The underflow case of mpfr_pow_pos_z() in rounding to nearest,
which was incorrect, is now handled by calling mpfr_pow_general(),
which can scale the result thus decide whether the rounded result
should be 0 or nextabove(0). To avoid the exact cases of x^y with
y integer (not supported by mpfr_pow_general()), rounding is done
in precision 2 (this is also faster!).
- Fixed underflow-related bug (case exact result = 2^(emin-2), in
rounding to nearest).
- Added log messages.
* pow_ui.c:
- Swapped parameters x and y for consistency (-> y = x^n).
- Fixed the internal overflows and underflows (which could yield
spurious overflows/underflows and incorrect results) by using
mpfr_pow_z.
* tests/tpow_all.c:
- Test flags in test_others and cmpres; cmpres argument z1 can now
be a null pointer (if unknown pure FP value, thus not tested).
- Added a test of 2^(emin - i/4) with 0 <= i <= 12, that triggered
the bugs mentioned above (and now fixed).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5505 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mpfr-impl.h')
-rw-r--r-- | mpfr-impl.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mpfr-impl.h b/mpfr-impl.h index a1f974c69..a23a4f4ff 100644 --- a/mpfr-impl.h +++ b/mpfr-impl.h @@ -1565,6 +1565,9 @@ __MPFR_DECLSPEC int mpfr_exp_2 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mp_rnd_t)); __MPFR_DECLSPEC int mpfr_exp_3 _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr,mp_rnd_t)); __MPFR_DECLSPEC int mpfr_powerof2_raw _MPFR_PROTO ((mpfr_srcptr)); +__MPFR_DECLSPEC int mpfr_pow_general _MPFR_PROTO ((mpfr_ptr, mpfr_srcptr, + mpfr_srcptr, mp_rnd_t, int, mpfr_save_expo_t *)); + __MPFR_DECLSPEC void mpfr_setmax _MPFR_PROTO ((mpfr_ptr, mp_exp_t)); __MPFR_DECLSPEC void mpfr_setmin _MPFR_PROTO ((mpfr_ptr, mp_exp_t)); |