Blame math/w_jnl_compat.c

Packit 6c4009
/* w_jnl.c -- long double version of w_jn.c.
Packit 6c4009
 * Conversion to long double by Ulrich Drepper,
Packit 6c4009
 * Cygnus Support, drepper@cygnus.com.
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * ====================================================
Packit 6c4009
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
Packit 6c4009
 *
Packit 6c4009
 * Developed at SunPro, a Sun Microsystems, Inc. business.
Packit 6c4009
 * Permission to use, copy, modify, and distribute this
Packit 6c4009
 * software is freely granted, provided that this notice
Packit 6c4009
 * is preserved.
Packit 6c4009
 * ====================================================
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#if defined(LIBM_SCCS) && !defined(lint)
Packit 6c4009
static char rcsid[] = "$NetBSD: $";
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/*
Packit 6c4009
 * wrapper jn(int n, double x), yn(int n, double x)
Packit 6c4009
 * floating point Bessel's function of the 1st and 2nd kind
Packit 6c4009
 * of order n
Packit 6c4009
 *
Packit 6c4009
 * Special cases:
Packit 6c4009
 *	y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
Packit 6c4009
 *	y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
Packit 6c4009
 * Note 2. About jn(n,x), yn(n,x)
Packit 6c4009
 *	For n=0, j0(x) is called,
Packit 6c4009
 *	for n=1, j1(x) is called,
Packit 6c4009
 *	for n
Packit 6c4009
 *	from values of j0(x) and j1(x).
Packit 6c4009
 *	for n>x, a continued fraction approximation to
Packit 6c4009
 *	j(n,x)/j(n-1,x) is evaluated and then backward
Packit 6c4009
 *	recursion is used starting from a supposed value
Packit 6c4009
 *	for j(n,x). The resulting value of j(0,x) is
Packit 6c4009
 *	compared with the actual value to correct the
Packit 6c4009
 *	supposed value of j(n,x).
Packit 6c4009
 *
Packit 6c4009
 *	yn(n,x) is similar in all respects, except
Packit 6c4009
 *	that forward recursion is used for all
Packit 6c4009
 *	values of n>1.
Packit 6c4009
 *
Packit 6c4009
 */
Packit 6c4009
Packit 6c4009
#include <math.h>
Packit 6c4009
#include <math_private.h>
Packit 6c4009
#include <math-svid-compat.h>
Packit 6c4009
#include <libm-alias-ldouble.h>
Packit 6c4009
Packit 6c4009
#if LIBM_SVID_COMPAT
Packit 6c4009
long double __jnl(int n, long double x)	/* wrapper jnl */
Packit 6c4009
{
Packit 6c4009
# ifdef _IEEE_LIBM
Packit 6c4009
	return __ieee754_jnl(n,x);
Packit 6c4009
# else
Packit 6c4009
	long double z;
Packit 6c4009
	z = __ieee754_jnl(n,x);
Packit 6c4009
	if (_LIB_VERSION == _IEEE_
Packit 6c4009
	    || _LIB_VERSION == _POSIX_
Packit 6c4009
	    || isnan(x))
Packit 6c4009
	  return z;
Packit 6c4009
	if(fabsl(x)>X_TLOSS) {
Packit 6c4009
	    return __kernel_standard_l((double)n,x,238); /* jn(|x|>X_TLOSS,n) */
Packit 6c4009
	} else
Packit 6c4009
	    return z;
Packit 6c4009
# endif
Packit 6c4009
}
Packit 6c4009
libm_alias_ldouble (__jn, jn)
Packit 6c4009
Packit 6c4009
long double __ynl(int n, long double x)	/* wrapper ynl */
Packit 6c4009
{
Packit 6c4009
# ifdef _IEEE_LIBM
Packit 6c4009
	return __ieee754_ynl(n,x);
Packit 6c4009
# else
Packit 6c4009
	long double z;
Packit 6c4009
	z = __ieee754_ynl(n,x);
Packit 6c4009
	if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
Packit 6c4009
        if(x <= 0.0){
Packit 6c4009
                if(x==0.0)
Packit 6c4009
                    /* d= -one/(x-x); */
Packit 6c4009
                    return __kernel_standard_l((double)n,x,212);
Packit 6c4009
                else
Packit 6c4009
                    /* d = zero/(x-x); */
Packit 6c4009
                    return __kernel_standard_l((double)n,x,213);
Packit 6c4009
        }
Packit 6c4009
	if(x>X_TLOSS && _LIB_VERSION != _POSIX_) {
Packit 6c4009
	    return __kernel_standard_l((double)n,x,239); /* yn(x>X_TLOSS,n) */
Packit 6c4009
	} else
Packit 6c4009
	    return z;
Packit 6c4009
# endif
Packit 6c4009
}
Packit 6c4009
libm_alias_ldouble (__yn, yn)
Packit 6c4009
#endif