2 /* @(#)w_jn.c 5.1 93/09/24 */
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7 * Developed at SunPro, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
11 * ====================================================
15 * wrapper jn(int n, double x), yn(int n, double x)
16 * floating point Bessel's function of the 1st and 2nd kind
20 * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal;
21 * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal.
22 * Note 2. About jn(n,x), yn(n,x)
23 * For n=0, j0(x) is called,
24 * for n=1, j1(x) is called,
25 * for n<x, forward recursion us used starting
26 * from values of j0(x) and j1(x).
27 * for n>x, a continued fraction approximation to
28 * j(n,x)/j(n-1,x) is evaluated and then backward
29 * recursion is used starting from a supposed value
30 * for j(n,x). The resulting value of j(0,x) is
31 * compared with the actual value to correct the
32 * supposed value of j(n,x).
34 * yn(n,x) is similar in all respects, except
35 * that forward recursion is used for all
43 #ifndef _DOUBLE_IS_32BITS
46 double jn(int n
, double x
) /* wrapper jn */
48 double jn(n
,x
) /* wrapper jn */
53 return __ieee754_jn(n
,x
);
57 z
= __ieee754_jn(n
,x
);
58 if(_LIB_VERSION
== _IEEE_
|| isnan(x
) ) return z
;
67 if (_LIB_VERSION
== _POSIX_
)
69 else if (!matherr(&exc
)) {
81 double yn(int n
, double x
) /* wrapper yn */
83 double yn(n
,x
) /* wrapper yn */
88 return __ieee754_yn(n
,x
);
92 z
= __ieee754_yn(n
,x
);
93 if(_LIB_VERSION
== _IEEE_
|| isnan(x
) ) return z
;
95 /* yn(n,0) = -inf or yn(x<0) = NaN */
100 SET_HIGH_WORD(inf
,0x7ff00000); /* set inf to infinite */
102 exc
.type
= DOMAIN
; /* should be SING for IEEE */
107 if (_LIB_VERSION
== _SVID_
)
110 exc
.retval
= -HUGE_VAL
;
111 if (_LIB_VERSION
== _POSIX_
)
113 else if (!matherr(&exc
)) {
128 if (_LIB_VERSION
== _POSIX_
)
130 else if (!matherr(&exc
)) {
141 #endif /* defined(_DOUBLE_IS_32BITS) */