xref: /netbsd/lib/libm/src/w_j1.c (revision bf9ec67e)
1 /* @(#)w_j1.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_j1.c,v 1.9 2002/05/26 22:02:01 wiz Exp $");
16 #endif
17 
18 /*
19  * wrapper of j1,y1
20  */
21 
22 #include "math.h"
23 #include "math_private.h"
24 
25 double
26 j1(double x)		/* wrapper j1 */
27 {
28 #ifdef _IEEE_LIBM
29 	return __ieee754_j1(x);
30 #else
31 	double z;
32 	z = __ieee754_j1(x);
33 	if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
34 	if(fabs(x)>X_TLOSS) {
35 	        return __kernel_standard(x,x,36); /* j1(|x|>X_TLOSS) */
36 	} else
37 	    return z;
38 #endif
39 }
40 
41 double
42 y1(double x)		/* wrapper y1 */
43 {
44 #ifdef _IEEE_LIBM
45 	return __ieee754_y1(x);
46 #else
47 	double z;
48 	z = __ieee754_y1(x);
49 	if(_LIB_VERSION == _IEEE_ || isnan(x) ) return z;
50         if(x <= 0.0){
51                 if(x==0.0)
52                     /* d= -one/(x-x); */
53                     return __kernel_standard(x,x,10);
54                 else
55                     /* d = zero/(x-x); */
56                     return __kernel_standard(x,x,11);
57         }
58 	if(x>X_TLOSS) {
59 	        return __kernel_standard(x,x,37); /* y1(x>X_TLOSS) */
60 	} else
61 	    return z;
62 #endif
63 }
64