xref: /netbsd/lib/libm/src/w_jnf.c (revision 6550d01e)
1 /* w_jnf.c -- float version of w_jn.c.
2  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3  */
4 
5 /*
6  * ====================================================
7  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8  *
9  * Developed at SunPro, a Sun Microsystems, Inc. business.
10  * Permission to use, copy, modify, and distribute this
11  * software is freely granted, provided that this notice
12  * is preserved.
13  * ====================================================
14  */
15 
16 #include <sys/cdefs.h>
17 #if defined(LIBM_SCCS) && !defined(lint)
18 __RCSID("$NetBSD: w_jnf.c,v 1.6 2002/05/26 22:02:02 wiz Exp $");
19 #endif
20 
21 #include "math.h"
22 #include "math_private.h"
23 
24 float
25 jnf(int n, float x)	/* wrapper jnf */
26 {
27 #ifdef _IEEE_LIBM
28 	return __ieee754_jnf(n,x);
29 #else
30 	float z;
31 	z = __ieee754_jnf(n,x);
32 	if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
33 	if(fabsf(x)>(float)X_TLOSS) {
34 	    /* jn(|x|>X_TLOSS,n) */
35 	    return (float)__kernel_standard((double)n,(double)x,138);
36 	} else
37 	    return z;
38 #endif
39 }
40 
41 float
42 ynf(int n, float x)	/* wrapper ynf */
43 {
44 #ifdef _IEEE_LIBM
45 	return __ieee754_ynf(n,x);
46 #else
47 	float z;
48 	z = __ieee754_ynf(n,x);
49 	if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
50         if(x <= (float)0.0){
51                 if(x==(float)0.0)
52                     /* d= -one/(x-x); */
53                     return (float)__kernel_standard((double)n,(double)x,112);
54                 else
55                     /* d = zero/(x-x); */
56                     return (float)__kernel_standard((double)n,(double)x,113);
57         }
58 	if(x>(float)X_TLOSS) {
59 	    /* yn(x>X_TLOSS,n) */
60 	    return (float)__kernel_standard((double)n,(double)x,139);
61 	} else
62 	    return z;
63 #endif
64 }
65