1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 #include "cephes_mconf.h" 7 8 #if defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__) 9 #include <math.h> 10 coshl(long double x)11long double coshl(long double x) 12 { 13 return cosh(x); 14 } 15 #else 16 17 #ifndef _SET_ERRNO 18 #define _SET_ERRNO(x) 19 #endif 20 coshl(long double x)21long double coshl(long double x) 22 { 23 long double y; 24 int x_class = fpclassify (x); 25 if (x_class == FP_NAN) 26 { 27 errno = EDOM; 28 return x; 29 } 30 else if (x_class == FP_INFINITE) 31 { 32 errno = ERANGE; 33 return INFINITY; 34 } 35 x = fabsl (x); 36 if (x > (MAXLOGL + LOGE2L)) 37 { 38 errno = ERANGE; 39 #ifdef INFINITIES 40 return (INFINITYL); 41 #else 42 return (MAXNUML); 43 #endif 44 } 45 if (x >= (MAXLOGL - LOGE2L)) 46 { 47 y = expl(0.5L * x); 48 y = (0.5L * y) * y; 49 return y; 50 } 51 y = expl(x); 52 y = 0.5L * (y + 1.0L / y); 53 return y; 54 } 55 #endif 56