Exemple #1
0
/* wrapper j1 */
double
j1 (double x)
{
    if (__builtin_expect (fabs (x) > X_TLOSS, 0) && _LIB_VERSION != _IEEE_)
        /* j1(|x|>X_TLOSS) */
        return __kernel_standard (x, x, 36);

    return __ieee754_j1 (x);
}
Exemple #2
0
void
Math_j1(void *fp)
{
	F_Math_j1 *f;

	f = fp;

	*f->ret = __ieee754_j1(f->x);
}
Exemple #3
0
double
__ieee754_y1(double x)
{
	double z, s,c,ss,cc,u,v;
	int32_t hx,ix,lx;

	EXTRACT_WORDS(hx,lx,x);
        ix = 0x7fffffff&hx;
	/*
	 * y1(NaN) = NaN.
	 * y1(Inf) = 0.
	 * y1(-Inf) = NaN and raise invalid exception.
	 */
	if(ix>=0x7ff00000) return  vone/(x+x*x); 
	/* y1(+-0) = -inf and raise divide-by-zero exception. */
        if((ix|lx)==0) return -one/vzero;
	/* y1(x<0) = NaN and raise invalid exception. */
        if(hx<0) return vzero/vzero;
        if(ix >= 0x40000000) {  /* |x| >= 2.0 */
                s = sin(x);
                c = cos(x);
                ss = -s-c;
                cc = s-c;
                if(ix<0x7fe00000) {  /* make sure x+x not overflow */
                    z = cos(x+x);
                    if ((s*c)>zero) cc = z/ss;
                    else            ss = z/cc;
                }
        /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
         * where x0 = x-3pi/4
         *      Better formula:
         *              cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
         *                      =  1/sqrt(2) * (sin(x) - cos(x))
         *              sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
         *                      = -1/sqrt(2) * (cos(x) + sin(x))
         * To avoid cancellation, use
         *              sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
         * to compute the worse one.
         */
                if(ix>0x48000000) z = (invsqrtpi*ss)/sqrt(x);
                else {
                    u = pone(x); v = qone(x);
                    z = invsqrtpi*(u*ss+v*cc)/sqrt(x);
                }
                return z;
        } 
        if(ix<=0x3c900000) {    /* x < 2**-54 */
            return(-tpi/x);
        } 
        z = x*x;
        u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4])));
        v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4]))));
        return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x));
}
Exemple #4
0
/*
 * @unimplemented
 */
double _j1(double num)
{
    if (!_finite(num)) *_errno() = EDOM;
    return __ieee754_j1(num);
}
Exemple #5
0
/*
 * @unimplemented
 */
double _j1(double num)
{
  /* FIXME: errno handling */
  return __ieee754_j1(num);
}