Skip to content
Snippets Groups Projects
Commit f869d6b2 authored by Damien George's avatar Damien George
Browse files

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

parent 23faf88c
No related branches found
No related tags found
No related merge requests found
...@@ -61,7 +61,12 @@ float log2f(float x) { return logf(x) / (float)_M_LN2; } ...@@ -61,7 +61,12 @@ float log2f(float x) { return logf(x) / (float)_M_LN2; }
static const float _M_LN10 = 2.30258509299404; // 0x40135d8e static const float _M_LN10 = 2.30258509299404; // 0x40135d8e
float log10f(float x) { return logf(x) / (float)_M_LN10; } 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);
}
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment