xref: /netbsd-src/lib/libm/src/w_j0.c (revision d9158b13b5dfe46201430699a3f7a235ecf28df3)
1 /* @(#)w_j0.c 5.1 93/09/24 */
2 /*
3  * ====================================================
4  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
5  *
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
9  * is preserved.
10  * ====================================================
11  */
12 
13 #ifndef lint
14 static char rcsid[] = "$Id: w_j0.c,v 1.3 1994/02/18 02:27:38 jtc Exp $";
15 #endif
16 
17 /*
18  * wrapper j0(double x), y0(double x)
19  */
20 
21 #include <math.h>
22 
23 #ifdef __STDC__
24 	double j0(double x)		/* wrapper j0 */
25 #else
26 	double j0(x)			/* wrapper j0 */
27 	double x;
28 #endif
29 {
30 #ifdef _IEEE_LIBM
31 	return __ieee754_j0(x);
32 #else
33 	double z = __ieee754_j0(x);
34 	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
35 	if(fabs(x)>X_TLOSS) {
36 	        return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */
37 	} else
38 	    return z;
39 #endif
40 }
41 
42 #ifdef __STDC__
43 	double y0(double x)		/* wrapper y0 */
44 #else
45 	double y0(x)			/* wrapper y0 */
46 	double x;
47 #endif
48 {
49 #ifdef _IEEE_LIBM
50 	return __ieee754_y0(x);
51 #else
52 	double z;
53 	z = __ieee754_y0(x);
54 	if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
55         if(x <= 0.0){
56                 if(x==0.0)
57                     /* d= -one/(x-x); */
58                     return __kernel_standard(x,x,8);
59                 else
60                     /* d = zero/(x-x); */
61                     return __kernel_standard(x,x,9);
62         }
63 	if(x>X_TLOSS) {
64 	        return __kernel_standard(x,x,35); /* y0(x>X_TLOSS) */
65 	} else
66 	    return z;
67 #endif
68 }
69