1#include "libm.h" 2 3#if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 4long double tanl(long double x) { 5 return tan(x); 6} 7#elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 8long double tanl(long double x) { 9 union ldshape u = {x}; 10 long double y[2]; 11 unsigned n; 12 13 u.i.se &= 0x7fff; 14 if (u.i.se == 0x7fff) 15 return x - x; 16 if (u.f < M_PI_4) { 17 if (u.i.se < 0x3fff - LDBL_MANT_DIG / 2) { 18 /* raise inexact if x!=0 and underflow if subnormal */ 19 FORCE_EVAL(u.i.se == 0 ? x * 0x1p-120f : x + 0x1p120f); 20 return x; 21 } 22 return __tanl(x, 0, 0); 23 } 24 n = __rem_pio2l(x, y); 25 return __tanl(y[0], y[1], n & 1); 26} 27#endif 28