diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-15 14:00:18 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-15 14:00:18 +0100 |
commit | 6ca0b4704367f8804e0373cb439e6e17e5146e4a (patch) | |
tree | 31ce5042bb575dd1afd6d309467c0c0d36e18914 /modules/fdlibm/src/e_hypot.cpp | |
parent | 85c60f94fb584ecab49743ab533e56f0f9981ecc (diff) | |
download | UXP-6ca0b4704367f8804e0373cb439e6e17e5146e4a.tar UXP-6ca0b4704367f8804e0373cb439e6e17e5146e4a.tar.gz UXP-6ca0b4704367f8804e0373cb439e6e17e5146e4a.tar.lz UXP-6ca0b4704367f8804e0373cb439e6e17e5146e4a.tar.xz UXP-6ca0b4704367f8804e0373cb439e6e17e5146e4a.zip |
Issue #1291 - Part 2: Stop using the lib's sqrt() function
Use <cmath>'s functions over fdlibm's for performance reasons.
No significant precision loss when doing this.
Diffstat (limited to 'modules/fdlibm/src/e_hypot.cpp')
-rw-r--r-- | modules/fdlibm/src/e_hypot.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/fdlibm/src/e_hypot.cpp b/modules/fdlibm/src/e_hypot.cpp index f5c7037bb..b34a1f575 100644 --- a/modules/fdlibm/src/e_hypot.cpp +++ b/modules/fdlibm/src/e_hypot.cpp @@ -46,6 +46,7 @@ * than 1 ulps (units in the last place) */ +#include <cmath> #include <float.h> #include "math_private.h" @@ -105,7 +106,7 @@ __ieee754_hypot(double x, double y) t1 = 0; SET_HIGH_WORD(t1,ha); t2 = a-t1; - w = sqrt(t1*t1-(b*(-b)-t2*(a+t1))); + w = std::sqrt(t1*t1-(b*(-b)-t2*(a+t1))); } else { a = a+a; y1 = 0; @@ -114,7 +115,7 @@ __ieee754_hypot(double x, double y) t1 = 0; SET_HIGH_WORD(t1,ha+0x00100000); t2 = a - t1; - w = sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); + w = std::sqrt(t1*y1-(w*(-w)-(t1*y2+t2*b))); } if(k!=0) { u_int32_t high; |