]>
Commit | Line | Data |
---|---|---|
ee188d55 RM |
1 | /* w_jnl.c -- long double version of w_jn.c. |
2 | * Conversion to long double by Ulrich Drepper, | |
3 | * Cygnus Support, drepper@cygnus.com. | |
4 | */ | |
5 | ||
6 | /* | |
7 | * ==================================================== | |
8 | * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. | |
9 | * | |
10 | * Developed at SunPro, a Sun Microsystems, Inc. business. | |
11 | * Permission to use, copy, modify, and distribute this | |
12 | * software is freely granted, provided that this notice | |
13 | * is preserved. | |
14 | * ==================================================== | |
15 | */ | |
16 | ||
17 | #if defined(LIBM_SCCS) && !defined(lint) | |
18 | static char rcsid[] = "$NetBSD: $"; | |
19 | #endif | |
20 | ||
21 | /* | |
22 | * wrapper jn(int n, double x), yn(int n, double x) | |
23 | * floating point Bessel's function of the 1st and 2nd kind | |
24 | * of order n | |
25 | * | |
26 | * Special cases: | |
27 | * y0(0)=y1(0)=yn(n,0) = -inf with division by zero signal; | |
28 | * y0(-ve)=y1(-ve)=yn(n,-ve) are NaN with invalid signal. | |
29 | * Note 2. About jn(n,x), yn(n,x) | |
30 | * For n=0, j0(x) is called, | |
31 | * for n=1, j1(x) is called, | |
32 | * for n<x, forward recursion us used starting | |
33 | * from values of j0(x) and j1(x). | |
34 | * for n>x, a continued fraction approximation to | |
35 | * j(n,x)/j(n-1,x) is evaluated and then backward | |
36 | * recursion is used starting from a supposed value | |
37 | * for j(n,x). The resulting value of j(0,x) is | |
38 | * compared with the actual value to correct the | |
39 | * supposed value of j(n,x). | |
40 | * | |
41 | * yn(n,x) is similar in all respects, except | |
42 | * that forward recursion is used for all | |
43 | * values of n>1. | |
44 | * | |
45 | */ | |
46 | ||
9d13fb24 | 47 | #include <math.h> |
9277c064 | 48 | #include <math_private.h> |
813378e9 | 49 | #include <math-svid-compat.h> |
92892fdb | 50 | #include <libm-alias-ldouble.h> |
ee188d55 | 51 | |
4f3647e4 | 52 | #if LIBM_SVID_COMPAT |
8db21882 | 53 | long double __jnl(int n, long double x) /* wrapper jnl */ |
ee188d55 | 54 | { |
4f3647e4 | 55 | # ifdef _IEEE_LIBM |
ee188d55 | 56 | return __ieee754_jnl(n,x); |
4f3647e4 | 57 | # else |
ee188d55 RM |
58 | long double z; |
59 | z = __ieee754_jnl(n,x); | |
c36e1d23 JM |
60 | if (_LIB_VERSION == _IEEE_ |
61 | || _LIB_VERSION == _POSIX_ | |
d81f90cc | 62 | || isnan(x)) |
c36e1d23 | 63 | return z; |
ee188d55 | 64 | if(fabsl(x)>X_TLOSS) { |
41bf21a1 | 65 | return __kernel_standard_l((double)n,x,238); /* jn(|x|>X_TLOSS,n) */ |
ee188d55 RM |
66 | } else |
67 | return z; | |
4f3647e4 | 68 | # endif |
ee188d55 | 69 | } |
92892fdb | 70 | libm_alias_ldouble (__jn, jn) |
ee188d55 | 71 | |
8db21882 | 72 | long double __ynl(int n, long double x) /* wrapper ynl */ |
ee188d55 | 73 | { |
4f3647e4 | 74 | # ifdef _IEEE_LIBM |
ee188d55 | 75 | return __ieee754_ynl(n,x); |
4f3647e4 | 76 | # else |
ee188d55 RM |
77 | long double z; |
78 | z = __ieee754_ynl(n,x); | |
d81f90cc | 79 | if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z; |
ee188d55 RM |
80 | if(x <= 0.0){ |
81 | if(x==0.0) | |
82 | /* d= -one/(x-x); */ | |
41bf21a1 | 83 | return __kernel_standard_l((double)n,x,212); |
ee188d55 RM |
84 | else |
85 | /* d = zero/(x-x); */ | |
41bf21a1 | 86 | return __kernel_standard_l((double)n,x,213); |
ee188d55 | 87 | } |
c36e1d23 | 88 | if(x>X_TLOSS && _LIB_VERSION != _POSIX_) { |
41bf21a1 | 89 | return __kernel_standard_l((double)n,x,239); /* yn(x>X_TLOSS,n) */ |
ee188d55 RM |
90 | } else |
91 | return z; | |
4f3647e4 | 92 | # endif |
ee188d55 | 93 | } |
92892fdb | 94 | libm_alias_ldouble (__yn, yn) |
4f3647e4 | 95 | #endif |