* ====================================================
*/
-/* Changes for 128-bit long double contributed by
- Stephen L. Moshier <moshier@na-net.ornl.gov> */
+/* Changes for 128-bit long double are
+ Copyright (C) 2001 Stephen L. Moshier <moshier@na-net.ornl.gov>
+ and are incorporated herein by permission of the author. The author
+ reserves the right to distribute this material elsewhere under different
+ copying permissions. These modifications are distributed here under
+ the following terms:
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, see
+ <https://www.gnu.org/licenses/>. */
/* __ieee754_coshl(x)
* Method :
* only coshl(0)=1 is exact for finite x.
*/
-#include "math.h"
-#include "math_private.h"
-
-#ifdef __STDC__
-static const long double one = 1.0, half = 0.5, huge = 1.0e4900L,
-ovf_thresh = 1.1357216553474703894801348310092223067821E4L;
-#else
-static long double one = 1.0, half = 0.5, huge = 1.0e4900L,
-ovf_thresh = 1.1357216553474703894801348310092223067821E4L;
-#endif
-
-#ifdef __STDC__
-long double
-__ieee754_coshl (long double x)
-#else
-long double
-__ieee754_coshl (x)
- long double x;
-#endif
+#include <math.h>
+#include <math_private.h>
+
+static const _Float128 one = 1.0, half = 0.5, huge = L(1.0e4900),
+ovf_thresh = L(1.1357216553474703894801348310092223067821E4);
+
+_Float128
+__ieee754_coshl (_Float128 x)
{
- long double t, w;
+ _Float128 t, w;
int32_t ex;
- u_int32_t mx, lx;
ieee854_long_double_shape_type u;
u.value = x;
/* |x| in [0,0.5*ln2], return 1+expm1l(|x|)^2/(2*expl(|x|)) */
if (ex < 0x3ffd62e4) /* 0.3465728759765625 */
{
+ if (ex < 0x3fb80000) /* |x| < 2^-116 */
+ return one; /* cosh(tiny) = 1 */
t = __expm1l (u.value);
w = one + t;
- if (ex < 0x3fc60000) /* |x| < 2^-57 */
- return w; /* cosh(tiny) = 1 */
return one + (t * t) / (w + w);
}
/* |x| > overflowthresold, cosh(x) overflow */
return huge * huge;
}
+strong_alias (__ieee754_coshl, __coshl_finite)