OSDN Git Service

Fix no pic
[uclinux-h8/uClinux-dist.git] / lib / libm / coshf.c
1 /*                                                      coshf.c
2  *
3  *      Hyperbolic cosine
4  *
5  *
6  *
7  * SYNOPSIS:
8  *
9  * float x, y, coshf();
10  *
11  * y = coshf( x );
12  *
13  *
14  *
15  * DESCRIPTION:
16  *
17  * Returns hyperbolic cosine of argument in the range MINLOGF to
18  * MAXLOGF.
19  *
20  * cosh(x)  =  ( exp(x) + exp(-x) )/2.
21  *
22  *
23  *
24  * ACCURACY:
25  *
26  *                      Relative error:
27  * arithmetic   domain     # trials      peak         rms
28  *    IEEE     +-MAXLOGF    100000      1.2e-7      2.8e-8
29  *
30  *
31  * ERROR MESSAGES:
32  *
33  *   message         condition      value returned
34  * coshf overflow  |x| > MAXLOGF       MAXNUMF
35  *
36  *
37  */
38 \f
39 /*                                                      cosh.c */
40
41 /*
42 Cephes Math Library Release 2.2:  June, 1992
43 Copyright 1985, 1987, 1992 by Stephen L. Moshier
44 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
45 */
46
47 #include "mconf.h"
48 extern float MAXLOGF, MAXNUMF;
49
50 #ifdef ANSIC
51 float expf(float);
52
53 float coshf(float xx)
54 #else
55 float expf();
56
57 float coshf(xx)
58 double xx;
59 #endif
60 {
61 float x, y;
62
63 x = xx;
64 if( x < 0 )
65         x = -x;
66 if( x > MAXLOGF )
67         {
68         mtherr( "coshf", OVERFLOW );
69         return( MAXNUMF );
70         }       
71 y = expf(x);
72 y = y + 1.0/y;
73 return( 0.5*y );
74 }