path: root/lib
diff options
authorSzabolcs Nagy <>2013-09-03 14:37:48 +0000
committerSzabolcs Nagy <>2013-09-05 11:30:07 +0000
commitc2a0dfea629617a39af2f59bd400e1a3595d0783 (patch)
treed0401b88980dba72d3c2dc21cf6a11642828a51b /lib
parentee2ee92d62c43f6658d37ddea4c316d2089d0fe9 (diff)
math: rewrite hypot
method: if there is a large difference between the scale of x and y then the larger magnitude dominates, otherwise reduce x,y so the argument of sqrt (x*x+y*y) does not overflow or underflow and calculate the argument precisely using exact multiplication. If the argument has less error than 1/sqrt(2) ~ 0.7 ulp, then the result has less error than 1 ulp in nearest rounding mode. the original fdlibm method was the same, except it used bit hacks instead of dekker-veltkamp algorithm, which is problematic for long double where different representations are supported. (the new hypot and hypotl code should be smaller and faster on 32bit cpu archs with fast fpu), the new code behaves differently in non-nearest rounding, but the error should be still less than 2ulps. ld80 and ld128 are supported
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions