summaryrefslogtreecommitdiff
path: root/exp.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-07-30 08:33:51 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2008-07-30 08:33:51 +0000
commitd1c69c6273fbbd3590751963f956470e0533f8d1 (patch)
tree7de49d717c7340c0302392093075f9d9fb8382a2 /exp.c
parentd4aa2fe73ce708decda9f7b05256b7fe899bee40 (diff)
downloadmpfr-d1c69c6273fbbd3590751963f956470e0533f8d1.tar.gz
exp.c: completed a comment, describing how rigorous underflow/overflow
detection can be done. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5461 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'exp.c')
-rw-r--r--exp.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/exp.c b/exp.c
index 8a718d7c9..95badbdc8 100644
--- a/exp.c
+++ b/exp.c
@@ -60,9 +60,22 @@ mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mp_rnd_t rnd_mode)
/* First, let's detect the underflow and overflow. */
/* FIXME: This is still incorrect for the underflow since MPFR chose
- underflow after rounding (the result is correct, though). Some
- overflow cases may not be detected (it would probably too difficult
- to detect them), but is this sufficient for the generic algorithms? */
+ underflow after rounding (the result is correct, though, only the
+ underflow flag may not). Some overflow cases may not be detected
+ (it would probably too difficult to detect them here), but is this
+ sufficient for the generic algorithms?
+ - After a simple modification to do like in the generic case of
+ mpfr_pow, exp_2.c can really detect exceptions rigorously: the
+ final mpfr_mul_2si must be done after MPFR_CAN_ROUND and the
+ rounding.
+ - The exp3.c routine computes a lower bound on the result, thus
+ detects overflows rigorously. Concerning the underflow, this
+ can be detected by a scaling. As the last operation is a square
+ (z^2), the scaling is needed (and very easy to do) only if an
+ underflow is generated by this operation.
+ As a consequence, we won't need a rigorous underflow/overflow
+ detection test here in exp.c (only the main cases of underflow
+ and overflow). */
{
mpfr_t elo, ehi, bound;
int slo, shi;