Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libm / mathfp / wf_jn.c
blob52602744142f1381d074ec21dab2781a5d99530a
1 /* wf_jn.c -- float version of w_jn.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3 */
5 /*
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
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 * ====================================================
16 #include "fdlibm.h"
17 #include <errno.h>
20 #ifdef __STDC__
21 float jnf(int n, float x) /* wrapper jnf */
22 #else
23 float jnf(n,x) /* wrapper jnf */
24 float x; int n;
25 #endif
27 #ifdef _IEEE_LIBM
28 return jnf(n,x);
29 #else
30 float z;
31 z = jnf(n,x);
32 if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
33 if(fabsf(x)>(float)X_TLOSS) {
34 /* jnf(|x|>X_TLOSS) */
35 errno = ERANGE;
36 return 0.0f;
37 } else
38 return z;
39 #endif
42 #ifdef __STDC__
43 float ynf(int n, float x) /* wrapper ynf */
44 #else
45 float ynf(n,x) /* wrapper ynf */
46 float x; int n;
47 #endif
49 #ifdef _IEEE_LIBM
50 return ynf(n,x);
51 #else
52 float z;
53 z = ynf(n,x);
54 if(_LIB_VERSION == _IEEE_ || isnanf(x) ) return z;
55 if(x <= 0.0f){
56 /* ynf(n,0) = -inf or ynf(x<0) = NaN */
57 #ifndef HUGE_VAL
58 #define HUGE_VAL inf
59 double inf = 0.0;
61 SET_HIGH_WORD(inf,0x7ff00000); /* set inf to infinite */
62 #endif
63 errno = EDOM;
64 return (float)-HUGE_VAL;
66 if(x>(float)X_TLOSS) {
67 /* ynf(x>X_TLOSS) */
68 errno = ERANGE;
69 return 0.0f;
70 } else
71 return z;
72 #endif
75 #ifdef _DOUBLE_IS_32BITS
77 #ifdef __STDC__
78 double jn(int n, double x)
79 #else
80 double jn(n,x)
81 double x; int n;
82 #endif
84 return (double) jnf(n, (float) x);
87 #ifdef __STDC__
88 double yn(int n, double x)
89 #else
90 double yn(n,x)
91 double x; int n;
92 #endif
94 return (double) ynf(n, (float) x);
97 #endif /* defined(_DOUBLE_IS_32BITS) */