2 /* @(#)w_j0.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 * ====================================================
16 <<jN>>,<<jNf>>,<<yN>>,<<yNf>>---Bessel functions
45 double j0(double <[x]>);
46 float j0f(float <[x]>);
47 double j1(double <[x]>);
48 float j1f(float <[x]>);
49 double jn(int <[n]>, double <[x]>);
50 float jnf(int <[n]>, float <[x]>);
51 double y0(double <[x]>);
52 float y0f(float <[x]>);
53 double y1(double <[x]>);
54 float y1f(float <[x]>);
55 double yn(int <[n]>, double <[x]>);
56 float ynf(int <[n]>, float <[x]>);
69 double jn(<[n]>, <[x]>)
72 float jnf(<[n]>, <[x]>)
84 double yn(<[n]>, <[x]>)
87 float ynf(<[n]>, <[x]>)
92 The Bessel functions are a family of functions that solve the
96 . x y'' + xy' + (x - p )y = 0
99 $$x^2{d^2y\over dx^2} + x{dy\over dx} + (x^2-p^2)y = 0$$
101 These functions have many applications in engineering and physics.
103 <<jn>> calculates the Bessel function of the first kind of order
104 <[n]>. <<j0>> and <<j1>> are special cases for order 0 and order
107 Similarly, <<yn>> calculates the Bessel function of the second kind of
108 order <[n]>, and <<y0>> and <<y1>> are special cases for order 0 and
111 <<jnf>>, <<j0f>>, <<j1f>>, <<ynf>>, <<y0f>>, and <<y1f>> perform the
112 same calculations, but on <<float>> rather than <<double>> values.
115 The value of each Bessel function at <[x]> is returned.
118 None of the Bessel functions are in ANSI C.
122 * wrapper j0(double x), y0(double x)
128 #ifndef _DOUBLE_IS_32BITS
131 double j0(double x
) /* wrapper j0 */
133 double j0(x
) /* wrapper j0 */
138 return __ieee754_j0(x
);
140 struct exception exc
;
141 double z
= __ieee754_j0(x
);
142 if(_LIB_VERSION
== _IEEE_
|| isnan(x
)) return z
;
143 if(fabs(x
)>X_TLOSS
) {
144 /* j0(|x|>X_TLOSS) */
148 exc
.arg1
= exc
.arg2
= x
;
150 if (_LIB_VERSION
== _POSIX_
)
152 else if (!matherr(&exc
)) {
164 double y0(double x
) /* wrapper y0 */
166 double y0(x
) /* wrapper y0 */
171 return __ieee754_y0(x
);
174 struct exception exc
;
176 if(_LIB_VERSION
== _IEEE_
|| isnan(x
) ) return z
;
182 SET_HIGH_WORD(inf
,0x7ff00000); /* set inf to infinite */
184 /* y0(0) = -inf or y0(x<0) = NaN */
185 exc
.type
= DOMAIN
; /* should be SING for IEEE y0(0) */
188 exc
.arg1
= exc
.arg2
= x
;
189 if (_LIB_VERSION
== _SVID_
)
192 exc
.retval
= -HUGE_VAL
;
193 if (_LIB_VERSION
== _POSIX_
)
195 else if (!matherr(&exc
)) {
207 exc
.arg1
= exc
.arg2
= x
;
209 if (_LIB_VERSION
== _POSIX_
)
211 else if (!matherr(&exc
)) {
222 #endif /* defined(_DOUBLE_IS_32BITS) */