long double __q_asind(long double *x) { ldquad u; long double result; u.ld = *x; if ( u.q.hi != u.q.hi ) { /* x is a NaN; return a quiet NaN */ #ifdef _IP_NAN_SETS_ERRNO *__errnoaddr = EDOM; #endif return ( __libm_qnan_ld ); } if ( *x == 0.0L ) return ( 0.0L ); if ( __qabs(*x) < 1.0L ) { result = __qasin(*x); return ( result*degprad.ld ); } if ( *x == 1.0L ) return ( 90.0L ); if ( *x == -1.0L ) return ( -90.0L ); *__errnoaddr = EDOM; return ( __libm_qnan_ld ); }
qcomplex __cqdiv(long double xqreal, long double xqimag, long double yqreal, long double yqimag) { long double tmp; unsigned int m, n; qcomplex result; if ((xqreal != xqreal) || (xqimag != xqimag) || (yqreal != yqreal) || (yqimag != yqimag)) { result.qreal = __libm_qnan_ld; result.qimag = __libm_qnan_ld; return result; } if ((yqreal == 0.0L) && (yqimag == 0.0L)) { result.qreal = xqreal/__libm_zero_ld; result.qimag = xqimag/__libm_zero_ld; return result; } if (yqreal == 0.0L) { result.qreal = xqimag/yqimag; result.qimag = -(xqreal/yqimag); return result; } if (yqimag == 0.0L) { result.qreal = xqreal/yqreal; result.qimag = xqimag/yqreal; return result; } if (__qabs(yqreal) <= __qabs(yqimag)) { /* turn off traps on underflow while computing yqreal/yqimag */ m = get_fpc_csr(); n = (m & 0xfffffeff); (void)set_fpc_csr(n); tmp = yqreal/yqimag; (void)set_fpc_csr(m); result.qreal = (xqimag + xqreal*tmp)/(yqimag + yqreal*tmp); result.qimag = (-xqreal + xqimag*tmp)/(yqimag + yqreal*tmp); return result; } /* turn off traps on underflow while computing yqimag/yqreal */ m = get_fpc_csr(); n = (m & 0xfffffeff); (void)set_fpc_csr(n); tmp = yqimag/yqreal; (void)set_fpc_csr(m); result.qreal = (xqreal + xqimag*tmp)/(yqreal + yqimag*tmp); result.qimag = (xqimag - xqreal*tmp)/(yqreal + yqimag*tmp); return result; }
long double __q_cosd(long double *x) { ldquad u; int n; double dn; long double result; u.ld = *x; if ( u.q.hi != u.q.hi ) { /* x is a NaN; return a quiet NaN */ #ifdef _IP_NAN_SETS_ERRNO *__errnoaddr = EDOM; #endif return ( __libm_qnan_ld ); } if ( __qabs(*x) == __libm_inf_ld ) { /* x is +/-Inf; return a quiet NaN */ *__errnoaddr = EDOM; return ( __libm_qnan_ld ); } if ( *x == 0.0L ) return ( 1.0L ); /* reduce arg to +/- 360 degrees */ u.ld = __qmod(u.ld, 360.0L); /* next, reduce to +/-45.0 */ if ( __qabs(u.ld) <= 45.0L ) { n = 0; } else { dn = u.q.hi*rninety.d; n = ROUND(dn); dn = n; u.ld = u.ld - dn*90.0L; } /* convert x to radians */ u.ld *= radspdeg.ld; if ( n&1) { if ( n&2 ) { /* * n%4 = 3 * result is sin(u) */ result = __qsin(u.ld); } else { /* * n%4 = 1 * result is -sin(u) */ result = -__qsin(u.ld); } return ( result ); } if ( n&2 ) { /* * n%4 = 2 * result is -cos(u) */ result = -__qcos(u.ld); } else { /* * n%4 = 0 * result is cos(u) */ result = __qcos(u.ld); } return( result ); }
long double __q_tand(long double *x) { ldquad u; int n; double dn; long double result; u.ld = *x; if ( u.q.hi != u.q.hi ) { /* x is a NaN; return a quiet NaN */ #ifdef _IP_NAN_SETS_ERRNO *__errnoaddr = EDOM; #endif return ( __libm_qnan_ld ); } if ( __qabs(*x) == __libm_inf_ld ) { /* x is +/-Inf; return a quiet NaN */ *__errnoaddr = EDOM; return ( __libm_qnan_ld ); } if ( *x == 0.0L ) return ( 0.0L ); /* reduce arg to +/- 180 degrees */ u.ld = __qmod(u.ld, 180.0L); /* next, reduce to +/-45.0 */ if ( __qabs(u.ld) <= 45.0L ) { n = 0; } else { dn = u.q.hi*rninety.d; n = ROUND(dn); dn = n; u.ld = u.ld - dn*90.0; } /* convert x to radians */ u.ld = u.ld*radspdeg.ld; if ( (n&1) == 0 ) { result = __qtan(u.ld); } else { if ( u.ld == 0.0L ) { *__errnoaddr = EDOM; return ( __libm_qnan_ld ); } result = -1.0L/__qtan(u.ld); } return ( result ); }