POK
jnf.c
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by julien on Fri Jan 30 14:41:34 2009
15  */
16 
17 /* w_jnf.c -- float version of w_jn.c.
18  * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
19  */
20 
21 /*
22  * ====================================================
23  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
24  *
25  * Developed at SunPro, a Sun Microsystems, Inc. business.
26  * Permission to use, copy, modify, and distribute this
27  * software is freely granted, provided that this notice
28  * is preserved.
29  * ====================================================
30  */
31 
32 
33 #ifdef POK_NEEDS_LIBMATH
34 
35 #include <libm.h>
36 #include "math_private.h"
37 
38 float
39 jnf(int n, float x) /* wrapper jnf */
40 {
41 #ifdef _IEEE_LIBM
42  return __ieee754_jnf(n,x);
43 #else
44  float z;
45  z = __ieee754_jnf(n,x);
46  if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
47  if(fabsf(x)>(float)X_TLOSS) {
48  /* jn(|x|>X_TLOSS,n) */
49  return (float)__kernel_standard((double)n,(double)x,138);
50  } else
51  return z;
52 #endif
53 }
54 
55 float
56 ynf(int n, float x) /* wrapper ynf */
57 {
58 #ifdef _IEEE_LIBM
59  return __ieee754_ynf(n,x);
60 #else
61  float z;
62  z = __ieee754_ynf(n,x);
63  if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
64  if(x <= (float)0.0){
65  if(x==(float)0.0)
66  /* d= -one/(x-x); */
67  return (float)__kernel_standard((double)n,(double)x,112);
68  else
69  /* d = zero/(x-x); */
70  return (float)__kernel_standard((double)n,(double)x,113);
71  }
72  if(x>(float)X_TLOSS) {
73  /* yn(x>X_TLOSS,n) */
74  return (float)__kernel_standard((double)n,(double)x,139);
75  } else
76  return z;
77 #endif
78 }
79 
80 #endif
81