Merge CRT changes from cmake branch (mainly MSVC compilation fixes)
[reactos.git] / reactos / lib / sdk / crt / math / tanh.c
1 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
2
3 #include <math.h>
4
5 #ifdef _MSC_VER
6 #pragma function(tanh)
7 #endif
8
9 /*
10 * @implemented
11 */
12 double tanh(double x)
13 {
14 if (x > 50)
15 return 1;
16 else if (x < -50)
17 return -1;
18 else
19 {
20 const double ebig = exp(x);
21 const double esmall = 1.0/ebig;
22 return (ebig - esmall) / (ebig + esmall);
23 }
24 }