this repo has no description
1/*
2 * by Ian Ollmann
3 * Copyright � 2005 by Apple Computer. All rights reserved.
4 *
5 * Algorithm from mathLib v3
6 */
7
8
9#include "math.h"
10#include "math_private.h"
11
12long double sinhl( long double x )
13{
14 static const long double overflow = 11356; //~ln(2)*16384
15
16 long double fabsx = __builtin_fabsl( x );
17
18 if( x != x ) return x + x;
19 if( fabsx == __builtin_infl() ) return x;
20
21 if( fabsx > 0x1.0p-32 ) //sqrt( negative epsilon )
22 {
23 if( fabsx < overflow )
24 {
25 fabsx = expm1l( fabsx );
26 fabsx = 0.5L * ( fabsx + fabsx / (1.0L + fabsx ) );
27 }
28 else
29 {
30 fabsx = expl( 0.5L * fabsx );
31 fabsx = ( 0.5L * fabsx ) * fabsx;
32 }
33 }
34 else
35 {
36 if( x == 0.0L )
37 return x;
38
39 //set inexact and underflow, if necessary
40 fabsx *= 0x1.0p67;
41 fabsx += 0x1.0p-16382L;
42 fabsx *= 0x1.0p-67;
43 }
44
45 if( x < 0.0 )
46 fabsx = -fabsx;
47
48 return fabsx;
49}