diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2013-06-06 05:48:37 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2013-06-06 05:48:37 +0000 |
commit | 7212dfb5f748e71a7d2c99ce5c694fa8eed49220 (patch) | |
tree | 299f47ede5f15990264cce6b524fc1d18491904a /src | |
parent | c90c20b913518fecac7287644e8ab4a5f2c8f3cf (diff) | |
download | mpfr-7212dfb5f748e71a7d2c99ce5c694fa8eed49220.tar.gz |
[mpfr-gmp.h] added replacement for mp_bitcnt_t
[hypot.c] added comment
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8580 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src')
-rw-r--r-- | src/hypot.c | 6 | ||||
-rw-r--r-- | src/mpfr-gmp.h | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/hypot.c b/src/hypot.c index cf27e2c98..1753541e1 100644 --- a/src/hypot.c +++ b/src/hypot.c @@ -142,7 +142,11 @@ mpfr_hypot (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode) /* Scale x and y to avoid overflow/underflow in x^2 and overflow in y^2 (as |x| >= |y|). The scaling of y can underflow only when the target precision is huge, otherwise the case would already have been handled - by the diff_exp > threshold code. */ + by the diff_exp > threshold code. + FIXME: Friedland in "Algorithm 312: Absolute Value and Square Root of a + Complex Number" (Communications of the ACM, 1967) avoids overflow by + computing |x|*sqrt(1+(y/x)^2) if |x| >= |y|, and |y|*sqrt(1+(x/y)^2) + otherwise. */ sh = mpfr_get_emax () / 2 - Ex - 1; MPFR_ZIV_INIT (loop, Nt); diff --git a/src/mpfr-gmp.h b/src/mpfr-gmp.h index d3dd4a2c4..1b7c76773 100644 --- a/src/mpfr-gmp.h +++ b/src/mpfr-gmp.h @@ -71,6 +71,11 @@ extern "C" { # error "Could not detect GMP_NUMB_BITS. Try with gmp internal files." #endif +/* Define mp_bitcnt_t if not present */ +#ifndef mp_bitcnt_t +#define mp_bitcnt_t unsigned long +#endif + /* Define some macros */ #define BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT) |