1use super::expm1f;
2use super::k_expo2f;
3
4#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
5pub fn sinhf(x: f32) -> f32 {
6 let mut h = 0.5f32;
7 let mut ix = x.to_bits();
8 if (ix >> 31) != 0 {
9 h = -h;
10 }
11 /* |x| */
12 ix &= 0x7fffffff;
13 let absx = f32::from_bits(ix);
14 let w = ix;
15
16 /* |x| < log(FLT_MAX) */
17 if w < 0x42b17217 {
18 let t = expm1f(absx);
19 if w < 0x3f800000 {
20 if w < (0x3f800000 - (12 << 23)) {
21 return x;
22 }
23 return h * (2. * t - t * t / (t + 1.));
24 }
25 return h * (t + t / (t + 1.));
26 }
27
28 /* |x| > logf(FLT_MAX) or nan */
29 2. * h * k_expo2f(absx)
30}
31