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

« back to all changes in this revision

Viewing changes to sysdeps/ieee754/ldbl-96/e_sinhl.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:
23
23
 * mathematically sinh(x) if defined to be (exp(x)-exp(-x))/2
24
24
 *      1. Replace x by |x| (sinhl(-x) = -sinhl(x)).
25
25
 *      2.
26
 
 *                                                   E + E/(E+1)
 
26
 *                                                   E + E/(E+1)
27
27
 *          0        <= x <= 25     :  sinhl(x) := --------------, E=expm1l(x)
28
 
 *                                                       2
 
28
 *                                                       2
29
29
 *
30
30
 *          25       <= x <= lnovft :  sinhl(x) := expl(x)/2
31
31
 *          lnovft   <= x <= ln2ovft:  sinhl(x) := expl(x/2)/2 * expl(x/2)
39
39
#include "math.h"
40
40
#include "math_private.h"
41
41
 
42
 
#ifdef __STDC__
43
42
static const long double one = 1.0, shuge = 1.0e4931L;
44
 
#else
45
 
static long double one = 1.0, shuge = 1.0e4931L;
46
 
#endif
47
43
 
48
 
#ifdef __STDC__
49
 
        long double __ieee754_sinhl(long double x)
50
 
#else
51
 
        long double __ieee754_sinhl(x)
52
 
        long double x;
53
 
#endif
 
44
long double
 
45
__ieee754_sinhl(long double x)
54
46
{
55
47
        long double t,w,h;
56
48
        u_int32_t jx,ix,i0,i1;
60
52
        ix = jx&0x7fff;
61
53
 
62
54
    /* x is INF or NaN */
63
 
        if(ix==0x7fff) return x+x;
 
55
        if(__builtin_expect(ix==0x7fff, 0)) return x+x;
64
56
 
65
57
        h = 0.5;
66
58
        if (jx & 0x8000) h = -h;
67
59
    /* |x| in [0,25], return sign(x)*0.5*(E+E/(E+1))) */
68
60
        if (ix < 0x4003 || (ix == 0x4003 && i0 <= 0xc8000000)) { /* |x|<25 */
69
 
            if (ix<0x3fdf)              /* |x|<2**-32 */
 
61
            if (ix<0x3fdf)              /* |x|<2**-32 */
70
62
                if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */
71
63
            t = __expm1l(fabsl(x));
72
64
            if(ix<0x3fff) return h*(2.0*t-t*t/(t+one));
89
81
    /* |x| > overflowthreshold, sinhl(x) overflow */
90
82
        return x*shuge;
91
83
}
 
84
strong_alias (__ieee754_sinhl, __sinhl_finite)