summaryrefslogtreecommitdiff
path: root/src/hypot.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2013-06-06 05:48:37 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2013-06-06 05:48:37 +0000
commit7212dfb5f748e71a7d2c99ce5c694fa8eed49220 (patch)
tree299f47ede5f15990264cce6b524fc1d18491904a /src/hypot.c
parentc90c20b913518fecac7287644e8ab4a5f2c8f3cf (diff)
downloadmpfr-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/hypot.c')
-rw-r--r--src/hypot.c6
1 files changed, 5 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);