OSDN Git Service

Fix no pic
[uclinux-h8/uClinux-dist.git] / lib / libm / asinhf.c
1 /*                                                      asinhf.c
2  *
3  *      Inverse hyperbolic sine
4  *
5  *
6  *
7  * SYNOPSIS:
8  *
9  * float x, y, asinhf();
10  *
11  * y = asinhf( x );
12  *
13  *
14  *
15  * DESCRIPTION:
16  *
17  * Returns inverse hyperbolic sine of argument.
18  *
19  * If |x| < 0.5, the function is approximated by a rational
20  * form  x + x**3 P(x)/Q(x).  Otherwise,
21  *
22  *     asinh(x) = log( x + sqrt(1 + x*x) ).
23  *
24  *
25  *
26  * ACCURACY:
27  *
28  *                      Relative error:
29  * arithmetic   domain     # trials      peak         rms
30  *    IEEE     -3,3        100000       2.4e-7      4.1e-8
31  *
32  */
33 \f
34 /*                                              asinh.c */
35
36 /*
37 Cephes Math Library Release 2.2:  June, 1992
38 Copyright 1984, 1987, 1988, 1992 by Stephen L. Moshier
39 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
40 */
41
42 /* Single precision inverse hyperbolic sine
43  * test interval: [-0.5, +0.5]
44  * trials: 10000
45  * peak relative error: 8.8e-8
46  * rms relative error: 3.2e-8
47  */
48 #include "mconf.h"
49 extern float LOGE2F;
50
51 #ifdef ANSIC
52 float logf( float );
53 float sqrtf( float );
54
55 float asinhf( float xx )
56 #else
57 float logf(), sqrtf();
58
59 float asinhf(xx)
60 double xx;
61 #endif
62 {
63 float x, z;
64
65 if( xx < 0 )
66         x = -xx;
67 else
68         x = xx;
69
70 if( x > 1500.0 )
71         {
72         z = logf(x) + LOGE2F;
73         goto done;
74         }
75 z = x * x;
76 if( x < 0.5 )
77         {
78         z =
79         ((( 2.0122003309E-2 * z
80           - 4.2699340972E-2) * z
81           + 7.4847586088E-2) * z
82           - 1.6666288134E-1) * z * x
83           + x;
84         }
85 else
86         {
87         z = sqrtf( z + 1.0 );
88         z = logf( x + z );
89         }
90 done:
91 if( xx < 0 )
92         z = -z;
93 return( z );
94 }
95