1 /* @(#)w_jn.c 5.1 93/09/24 */
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
10 * ====================================================
13 #if defined(LIBM_SCCS) && !defined(lint)
14 static char rcsid
[] = "$NetBSD: w_jn.c,v 1.6 1995/05/10 20:49:19 jtc Exp $";
18 * wrapper jn(int n, double x), yn(int n, double x)
19 * floating point Bessel's function of the 1st and 2nd kind
23 * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
24 * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
25 * Note 2. About jn(n,x), yn(n,x)
26 * For n=0, j0(x) is called,
27 * for n=1, j1(x) is called,
28 * for n<x, forward recursion us used starting
29 * from values of j0(x) and j1(x).
30 * for n>x, a continued fraction approximation to
31 * j(n,x)/j(n-1,x) is evaluated and then backward
32 * recursion is used starting from a supposed value
33 * for j(n,x). The resulting value of j(0,x) is
34 * compared with the actual value to correct the
35 * supposed value of j(n,x).
37 * yn(n,x) is similar in all respects, except
38 * that forward recursion is used for all
44 #include "math_private.h"
47 double jn(int n
, double x
) /* wrapper jn */
49 double jn(n
,x
) /* wrapper jn */
54 return __ieee754_jn(n
,x
);
57 z
= __ieee754_jn(n
,x
);
58 if(_LIB_VERSION
== _IEEE_
|| __isnan(x
) ) return z
;
60 return __kernel_standard((double)n
,x
,38); /* jn(|x|>X_TLOSS,n) */
66 strong_alias (jn
, jnl
)
71 double yn(int n
, double x
) /* wrapper yn */
73 double yn(n
,x
) /* wrapper yn */
78 return __ieee754_yn(n
,x
);
81 z
= __ieee754_yn(n
,x
);
82 if(_LIB_VERSION
== _IEEE_
|| __isnan(x
) ) return z
;
86 return __kernel_standard((double)n
,x
,12);
89 return __kernel_standard((double)n
,x
,13);
92 return __kernel_standard((double)n
,x
,39); /* yn(x>X_TLOSS,n) */
98 strong_alias (yn
, ynl
)