123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- #include <openlibm_math.h>
- #include "math_private.h"
- static const long double
- one = 1.0L,
- ln2 = 6.931471805599453094172321214581765681e-1L,
- huge = 1.0e+4900L;
- long double
- asinhl(long double x)
- {
- long double t, w;
- int32_t ix, sign;
- ieee_quad_shape_type u;
- u.value = x;
- sign = u.parts32.mswhi;
- ix = sign & 0x7fffffff;
- if (ix == 0x7fff0000)
- return x + x;
- if (ix < 0x3fc70000)
- {
- if (huge + x > one)
- return x;
- }
- u.parts32.mswhi = ix;
- if (ix > 0x40350000)
- {
- w = logl (u.value) + ln2;
- }
- else if (ix >0x40000000)
- {
- t = u.value;
- w = logl (2.0 * t + one / (sqrtl (x * x + one) + t));
- }
- else
- {
- t = x * x;
- w = log1pl (u.value + t / (one + sqrtl (one + t)));
- }
- if (sign & 0x80000000)
- return -w;
- else
- return w;
- }
|