]>
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> |
ee188d55 RM |
49 | |
50 | #ifdef __STDC__ | |
c6251f03 | 51 | long double __jnl(int n, long double x) /* wrapper jnl */ |
ee188d55 | 52 | #else |
c6251f03 | 53 | long double __jnl(n,x) /* wrapper jnl */ |
ee188d55 RM |
54 | long double x; int n; |
55 | #endif | |
56 | { | |
57 | #ifdef _IEEE_LIBM | |
58 | return __ieee754_jnl(n,x); | |
59 | #else | |
60 | long double z; | |
61 | z = __ieee754_jnl(n,x); | |
62 | if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z; | |
63 | if(fabsl(x)>X_TLOSS) { | |
64 | return __kernel_standard((double)n,x,238); /* jn(|x|>X_TLOSS,n) */ | |
65 | } else | |
66 | return z; | |
67 | #endif | |
68 | } | |
c6251f03 | 69 | weak_alias (__jnl, jnl) |
ee188d55 RM |
70 | |
71 | #ifdef __STDC__ | |
c6251f03 | 72 | long double __ynl(int n, long double x) /* wrapper ynl */ |
ee188d55 | 73 | #else |
c6251f03 | 74 | long double __ynl(n,x) /* wrapper ynl */ |
ee188d55 RM |
75 | long double x; int n; |
76 | #endif | |
77 | { | |
78 | #ifdef _IEEE_LIBM | |
79 | return __ieee754_ynl(n,x); | |
80 | #else | |
81 | long double z; | |
82 | z = __ieee754_ynl(n,x); | |
83 | if(_LIB_VERSION == _IEEE_ || __isnanl(x) ) return z; | |
84 | if(x <= 0.0){ | |
85 | if(x==0.0) | |
86 | /* d= -one/(x-x); */ | |
87 | return __kernel_standard((double)n,x,212); | |
88 | else | |
89 | /* d = zero/(x-x); */ | |
90 | return __kernel_standard((double)n,x,213); | |
91 | } | |
92 | if(x>X_TLOSS) { | |
93 | return __kernel_standard((double)n,x,239); /* yn(x>X_TLOSS,n) */ | |
94 | } else | |
95 | return z; | |
96 | #endif | |
97 | } | |
c6251f03 | 98 | weak_alias (__ynl, ynl) |