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/s_asinh.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/s_asinh.cpp')
-rw-r--r-- | modules/fdlibm/src/s_asinh.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/fdlibm/src/s_asinh.cpp b/modules/fdlibm/src/s_asinh.cpp index 400fd89c1..7ecc396bb 100644 --- a/modules/fdlibm/src/s_asinh.cpp +++ b/modules/fdlibm/src/s_asinh.cpp @@ -24,6 +24,7 @@ * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) */ +#include <cmath> #include <float.h> #include "math_private.h" @@ -48,10 +49,10 @@ asinh(double x) w = __ieee754_log(fabs(x))+ln2; } else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */ t = fabs(x); - w = __ieee754_log(2.0*t+one/(__ieee754_sqrt(x*x+one)+t)); + w = __ieee754_log(2.0*t+one/(std::sqrt(x*x+one)+t)); } else { /* 2.0 > |x| > 2**-28 */ t = x*x; - w =log1p(fabs(x)+t/(one+__ieee754_sqrt(one+t))); + w =log1p(fabs(x)+t/(one+std::sqrt(one+t))); } if(hx>0) return w; else return -w; } |