xref: /netbsd/lib/libm/src/w_j0.c (revision 6550d01e)
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 #include <sys/cdefs.h>
14 #if defined(LIBM_SCCS) && !defined(lint)
15 __RCSID("$NetBSD: w_j0.c,v 1.9 2002/05/26 22:02:01 wiz Exp $");
16 #endif
17 
18 /*
19  * wrapper j0(double x), y0(double x)
20  */
21 
22 #include "math.h"
23 #include "math_private.h"
24 
25 double
26 j0(double x)		/* wrapper j0 */
27 {
28 #ifdef _IEEE_LIBM
29 	return __ieee754_j0(x);
30 #else
31 	double z = __ieee754_j0(x);
32 	if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;
33 	if(fabs(x)>X_TLOSS) {
34 	        return __kernel_standard(x,x,34); /* j0(|x|>X_TLOSS) */
35 	} else
36 	    return z;
37 #endif
38 }
39 
40 double
41 y0(double x)		/* wrapper y0 */
42 {
43 #ifdef _IEEE_LIBM
44 	return __ieee754_y0(x);
45 #else
46 	double z;
47 	z = __ieee754_y0(x);
48 	if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
49         if(x <= 0.0){
50                 if(x==0.0)
51                     /* d= -one/(x-x); */
52                     return __kernel_standard(x,x,8);
53                 else
54                     /* d = zero/(x-x); */
55                     return __kernel_standard(x,x,9);
56         }
57 	if(x>X_TLOSS) {
58 	        return __kernel_standard(x,x,35); /* y0(x>X_TLOSS) */
59 	} else
60 	    return z;
61 #endif
62 }
63