configure+libm.h: add hypot emulation
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>
Sat, 14 Nov 2015 16:57:28 +0000 (11:57 -0500)
committerGanesh Ajjanagadde <gajjanagadde@gmail.com>
Sat, 21 Nov 2015 13:51:49 +0000 (08:51 -0500)
commit275aca8fba50e77af16627d8d5db4b3d4987d889
tree7b0d88db7fb09ddbe2235c5caf43a5832d580fe1
parent14ea4151d7c3c26500193f11ac661ed20c7c2b9c
configure+libm.h: add hypot emulation

It is known that the naive sqrt(x*x + y*y) approach for computing the
hypotenuse suffers from overflow and accuracy issues, see e.g
http://www.johndcook.com/blog/2010/06/02/whats-so-hard-about-finding-a-hypotenuse/.
This adds hypot support to FFmpeg, a C99 function.

On platforms without hypot, this patch does a reaonable workaround, that
although not as accurate as GNU libm, is readable and does not suffer
from the overflow issue. Improvements can be made separately.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
configure
libavutil/libm.h