summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-06-30 13:03:27 +0000
committerenge <enge@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2012-06-30 13:03:27 +0000
commit280dbfc1a2b34b7fefeba9f3801e51187f1ef0ad (patch)
treef9f7023dce1a228ffaf99b3ca47656510e75dc91
parente41afeca3276542de99afc70e8dd7ee80774a9ae (diff)
downloadmpc-280dbfc1a2b34b7fefeba9f3801e51187f1ef0ad.tar.gz
log.dat: add example with intermediate underflow
log.c: handle intermediate underflow git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@1209 211d60ee-9f03-0410-a15a-8952a2c7a4e4
-rw-r--r--src/log.c4
-rw-r--r--tests/log.dat2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/log.c b/src/log.c
index 5358ee6..d9f19fd 100644
--- a/src/log.c
+++ b/src/log.c
@@ -144,8 +144,8 @@ do { \
/* w is rounded down */
inex = mpc_norm (w, op, GMP_RNDN);
/* error 0.5 ulp */
- if (mpfr_inf_p (w))
- /* intermediate overflow; the logarithm may be representable */
+ if (mpfr_inf_p (w) || mpfr_zero_p (w))
+ /* intermediate over- or underflow; the logarithm may be representable */
break;
if (inex && mpfr_cmp_ui (w, 1) == 0)
/* this is like an underflow; the following call to log will
diff --git a/tests/log.dat b/tests/log.dat
index 6972cfc..699045b 100644
--- a/tests/log.dat
+++ b/tests/log.dat
@@ -169,6 +169,8 @@
# Example leading to intermediate overflow in x^2+y^2
+ + 53 0x58B90BFD4BCBFp-22 2 0x1p0 2 0x1p536870912 2 0x1p536870912 U U
+# Example leading to intermediate underflow in x^2+y^2
+- - 53 -0x58B90BFB3775A8p-25 2 0x3p-2 2 0x1p-1073741824 2 0x1p-1073741824 D D
# Due to intermediate "underflow" (see FIXME in log.c), the following example
# loops.