~ubuntu-branches/ubuntu/precise/eglibc/precise-201308281639

« back to all changes in this revision

Viewing changes to sysdeps/ieee754/ldbl-96/e_atanhl.c

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2012-02-08 01:58:09 UTC
  • mfrom: (1.5.3) (288.1.12 precise)
  • Revision ID: package-import@ubuntu.com-20120208015809-ulscst7uteq3e22z
Tags: 2.15~pre6-0ubuntu10
Merge from Debian (r5151, 2.13-26).

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 * ====================================================
15
15
 */
16
16
 
17
 
#if defined(LIBM_SCCS) && !defined(lint)
18
 
static char rcsid[] = "$NetBSD: $";
19
 
#endif
20
 
 
21
17
/* __ieee754_atanhl(x)
22
18
 * Method :
23
19
 *    1.Reduced x to positive by atanh(-x) = -atanh(x)
26
22
 *      atanhl(x) = --- * log(1 + -------) = 0.5 * log1p(2 * --------)
27
23
 *                   2             1 - x                      1 - x
28
24
 *
29
 
 *      For x<0.5
 
25
 *      For x<0.5
30
26
 *      atanhl(x) = 0.5*log1pl(2x+2x*x/(1-x))
31
27
 *
32
28
 * Special cases:
39
35
#include "math.h"
40
36
#include "math_private.h"
41
37
 
42
 
#ifdef __STDC__
43
38
static const long double one = 1.0, huge = 1e4900L;
44
 
#else
45
 
static long double one = 1.0, huge = 1e4900L;
46
 
#endif
47
39
 
48
 
#ifdef __STDC__
49
40
static const long double zero = 0.0;
50
 
#else
51
 
static double long zero = 0.0;
52
 
#endif
53
41
 
54
 
#ifdef __STDC__
55
 
        long double __ieee754_atanhl(long double x)
56
 
#else
57
 
        long double __ieee754_atanhl(x)
58
 
        long double x;
59
 
#endif
 
42
long double
 
43
__ieee754_atanhl(long double x)
60
44
{
61
45
        long double t;
62
46
        int32_t ix;
68
52
            return (x-x)/(x-x);
69
53
        if(ix==0x3fff)
70
54
            return x/zero;
71
 
        if(ix<0x3fe3&&(huge+x)>zero) return x;  /* x<2**-28 */
 
55
        if(ix<0x3fe3) {
 
56
            math_force_eval(huge+x);
 
57
            return x;   /* x<2**-28 */
 
58
        }
72
59
        SET_LDOUBLE_EXP(x,ix);
73
60
        if(ix<0x3ffe) {         /* x < 0.5 */
74
61
            t = x+x;
77
64
            t = 0.5*__log1pl((x+x)/(one-x));
78
65
        if(se<=0x7fff) return t; else return -t;
79
66
}
 
67
strong_alias (__ieee754_atanhl, __atanhl_finite)