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

crypto-aes
Damien George 5 years ago
parent 23faf88cab
commit f869d6b2e3
  1. 7
      lib/libm/math.c

@ -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);
}
/*****************************************************************************/
/*****************************************************************************/

Loading…
Cancel
Save