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 #include <sys/cdefs.h>
14 #if defined(LIBM_SCCS) && !defined(lint)
15 __RCSID("$NetBSD: w_jn.c,v 1.9 2002/05/26 22:02:01 wiz Exp $");
19 * wrapper jn(int n, double x), yn(int n, double x)
20 * floating point Bessel's function of the 1st and 2nd kind
24 * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
25 * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
26 * Note 2. About jn(n,x), yn(n,x)
27 * For n=0, j0(x) is called,
28 * for n=1, j1(x) is called,
29 * for n<x, forward recursion us used starting
30 * from values of j0(x) and j1(x).
31 * for n>x, a continued fraction approximation to
32 * j(n,x)/j(n-1,x) is evaluated and then backward
33 * recursion is used starting from a supposed value
34 * for j(n,x). The resulting value of j(0,x) is
35 * compared with the actual value to correct the
36 * supposed value of j(n,x).
38 * yn(n,x) is similar in all respects, except
39 * that forward recursion is used for all
45 #include "math_private.h"
48 jn(int n
, double x
) /* wrapper jn */
51 return __ieee754_jn(n
,x
);
54 z
= __ieee754_jn(n
,x
);
55 if(_LIB_VERSION
== _IEEE_
|| isnan(x
) ) return z
;
57 return __kernel_standard((double)n
,x
,38); /* jn(|x|>X_TLOSS,n) */
64 yn(int n
, double x
) /* wrapper yn */
67 return __ieee754_yn(n
,x
);
70 z
= __ieee754_yn(n
,x
);
71 if(_LIB_VERSION
== _IEEE_
|| isnan(x
) ) return z
;
75 return __kernel_standard((double)n
,x
,12);
78 return __kernel_standard((double)n
,x
,13);
81 return __kernel_standard((double)n
,x
,39); /* yn(x>X_TLOSS,n) */