lib/libm: Fix tanhf so that it correctly handles +/- infinity args.

This commit is contained in:
Damien George 2017-10-04 21:14:00 +11:00
parent 23faf88cab
commit f869d6b2e3
1 changed files with 6 additions and 1 deletions

View File

@ -61,7 +61,12 @@ float log2f(float x) { return logf(x) / (float)_M_LN2; }
static const float _M_LN10 = 2.30258509299404; // 0x40135d8e
float log10f(float x) { return logf(x) / (float)_M_LN10; }
float tanhf(float x) { return sinhf(x) / coshf(x); }
float tanhf(float x) {
if (isinf(x)) {
return copysignf(1, x);
}
return sinhf(x) / coshf(x);
}
/*****************************************************************************/
/*****************************************************************************/