summaryrefslogtreecommitdiff
path: root/exp.c
diff options
context:
space:
mode:
Diffstat (limited to 'exp.c')
-rw-r--r--exp.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/exp.c b/exp.c
index 7cd8164b1..9be1202ba 100644
--- a/exp.c
+++ b/exp.c
@@ -47,6 +47,15 @@ mpfr_exp(y, x, rnd_mode)
mpfr_t r, s, t;
if (MPFR_IS_NAN(x)) { MPFR_SET_NAN(y); return 1; }
+ if (MPFR_IS_INF(x))
+ {
+ if (MPFR_SIGN(x) > 0)
+ { MPFR_SET_INF(y); if (MPFR_SIGN(y) == -1) { MPFR_CHANGE_SIGN(y); } }
+ else
+ { MPFR_SET_ZERO(y); if (MPFR_SIGN(y) == -1) { MPFR_CHANGE_SIGN(y); } }
+ /* TODO: conflits entre infinis et zeros ? */
+ }
+
if (!MPFR_NOTZERO(x)) { mpfr_set_ui(y, 1, GMP_RNDN); return 0; }
expx = MPFR_EXP(x);