diff options
author | Richard Lowe <richlowe@richlowe.net> | 2019-06-03 18:33:00 +0000 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2019-06-06 20:20:31 +0000 |
commit | 685c1a21304711e8d0a21bade51b783487d53044 (patch) | |
tree | d596eaf9e1ec9575088d1adbbba12eb3ba83be38 /usr/src/lib/libm/common/C/tanh.c | |
parent | d0bed8f264c913bf83285b0beed22bd3a9f7eb08 (diff) | |
download | illumos-gate-685c1a21304711e8d0a21bade51b783487d53044.tar.gz |
11175 libm should use signbit() correctly
11188 c99 math macros should return strictly backward compatible values
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/lib/libm/common/C/tanh.c')
-rw-r--r-- | usr/src/lib/libm/common/C/tanh.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr/src/lib/libm/common/C/tanh.c b/usr/src/lib/libm/common/C/tanh.c index 2c3d5f6deb..6bf6b471e8 100644 --- a/usr/src/lib/libm/common/C/tanh.c +++ b/usr/src/lib/libm/common/C/tanh.c @@ -67,7 +67,8 @@ static const double /* INDENT ON */ double -tanh(double x) { +tanh(double x) +{ double t, y, z; int signx; volatile double dummy __unused; @@ -94,7 +95,7 @@ tanh(double x) { } else if (!finite(t)) return (copysign(1.0, x)); else - return (signx == 1 ? -z + small * small : z - small * small); + return ((signx != 0) ? -z + small * small : z - small * small); - return (signx == 1 ? -z : z); + return ((signx != 0) ? -z : z); } |