diff options
Diffstat (limited to 'src/math/tanh.c')
| -rw-r--r-- | src/math/tanh.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/math/tanh.c b/src/math/tanh.c index d64be283..cf5bf028 100644 --- a/src/math/tanh.c +++ b/src/math/tanh.c @@ -6,6 +6,12 @@ /** hyperbolic tangent **/ TYPE TGFN(tanh)(TYPE x) { + switch (fpclassify(x)) { + case FP_ZERO: return x; + case FP_INFINITE: return signbit(x) ? -1.0 : 1.0; + default: break; + } + if (0) { errno = ERANGE; /* The result cannot be represented */ /* RETURN_FAILURE(CONSTANT(HUGE_VAL), A range error occurred); */ |
