diff options
author | 2011-07-02 19:40:01 +0000 | |
---|---|---|
committer | 2011-07-02 19:40:01 +0000 | |
commit | 6d7e72cbfa0a9827aed9625a73ee55d640808bbb (patch) | |
tree | 764ccae709e296fe080576fc42d082bdadc850af | |
parent | Trick lint into recording the right prototypes in the llib-lc.ln (diff) | |
download | wireguard-openbsd-6d7e72cbfa0a9827aed9625a73ee55d640808bbb.tar.xz wireguard-openbsd-6d7e72cbfa0a9827aed9625a73ee55d640808bbb.zip |
For tiny x, tanhf = x*(one+x). GCC (at -O2) optimized this into
x+x*x, as a result sign got lost for the zero inputs. Explicitly
return in this case, similarly like has been done in tanh.
-rw-r--r-- | lib/libm/src/s_tanhf.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/libm/src/s_tanhf.c b/lib/libm/src/s_tanhf.c index 21271e3b6c7..946e059cf96 100644 --- a/lib/libm/src/s_tanhf.c +++ b/lib/libm/src/s_tanhf.c @@ -35,6 +35,8 @@ tanhf(float x) /* |x| < 22 */ if (ix < 0x41b00000) { /* |x|<22 */ + if (ix == 0) + return x; /* x == +-0 */ if (ix<0x24000000) /* |x|<2**-55 */ return x*(one+x); /* tanh(small) = small */ if (ix>=0x3f800000) { /* |x|>=1 */ |