summaryrefslogtreecommitdiff
path: root/src/hypot.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2013-06-06 12:28:06 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2013-06-06 12:28:06 +0000
commita120aadc2d274e9f821c9a7b737759763924403a (patch)
treeaa5d0b7a585a9b509e3e08ecdf25d40be56b12ec /src/hypot.c
parent7cfb1f8b349c48b3cb2725aa4bb17d83d8462127 (diff)
downloadmpfr-a120aadc2d274e9f821c9a7b737759763924403a.tar.gz
[src/hypot.c] Added a comment on the FIXME.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8586 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/hypot.c')
-rw-r--r--src/hypot.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/hypot.c b/src/hypot.c
index 1753541e1..0b75ed4d2 100644
--- a/src/hypot.c
+++ b/src/hypot.c
@@ -146,7 +146,14 @@ mpfr_hypot (mpfr_ptr z, mpfr_srcptr x, mpfr_srcptr y, mpfr_rnd_t rnd_mode)
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. */
+ otherwise.
+ [VL] This trick (which is a scaling by a non-power of 2, thus doesn't
+ really bring new behavior w.r.t. overflow/underflow exceptions) may be
+ useful for hardware floating-point formats because a whole power-of-2
+ scaling code is likely to take more time than the additional division,
+ but in the context of multiple-precision, I doubt that it is a good
+ idea. Ideally scaling by a power of 2 could be done in a constant time,
+ e.g. with MPFR_ALIAS; but one needs to be very careful... */
sh = mpfr_get_emax () / 2 - Ex - 1;
MPFR_ZIV_INIT (loop, Nt);