ReactOS 0.4.15-dev-8109-gd7be748
j1_y1.c File Reference
#include "math.h"
#include "ieee754.h"
Include dependency graph for j1_y1.c:

Go to the source code of this file.

Functions

static double pone ()
 
static double qone ()
 
double __ieee754_j1 (double x)
 
double __ieee754_y1 (double x)
 
static double pone (double x)
 
static double qone (double x)
 

Variables

static double huge = 1e300
 
static double one = 1.0
 
static double invsqrtpi = 5.64189583547756279280e-01
 
static double tpi = 6.36619772367581382433e-01
 
static double R []
 
static double S []
 
static double zero = 0.0
 
static double U0 [5]
 
static double V0 [5]
 
static double pr8 [6]
 
static double ps8 [5]
 
static double pr5 [6]
 
static double ps5 [5]
 
static double pr3 [6]
 
static double ps3 [5]
 
static double pr2 [6]
 
static double ps2 [5]
 
static double qr8 [6]
 
static double qs8 [6]
 
static double qr5 [6]
 
static double qs5 [6]
 
static double qr3 [6]
 
static double qs3 [6]
 
static double qr2 [6]
 
static double qs2 [6]
 

Function Documentation

◆ __ieee754_j1()

double __ieee754_j1 ( double  x)

Definition at line 103 of file j1_y1.c.

106{
107 double z, s,c,ss,cc,r,u,v,y,r1,r2,s1,s2,s3,z2,z4;
108 int32_t hx,ix;
109
110 GET_HIGH_WORD(hx,x);
111 ix = hx&0x7fffffff;
112 if(ix>=0x7ff00000) return one/x;
113 y = fabs(x);
114 if(ix >= 0x40000000) { /* |x| >= 2.0 */
115 __sincos (y, &s, &c);
116 ss = -s-c;
117 cc = s-c;
118 if(ix<0x7fe00000) { /* make sure y+y not overflow */
119 z = __cos(y+y);
120 if ((s*c)>zero) cc = z/ss;
121 else ss = z/cc;
122 }
123 /*
124 * j1(x) = 1/sqrt(pi) * (P(1,x)*cc - Q(1,x)*ss) / sqrt(x)
125 * y1(x) = 1/sqrt(pi) * (P(1,x)*ss + Q(1,x)*cc) / sqrt(x)
126 */
127 if(ix>0x48000000) z = (invsqrtpi*cc)/__ieee754_sqrt(y);
128 else {
129 u = pone(y); v = qone(y);
131 }
132 if(hx<0) return -z;
133 else return z;
134 }
135 if(ix<0x3e400000) { /* |x|<2**-27 */
136 if(huge+x>one) return 0.5*x;/* inexact if x!=0 necessary */
137 }
138 z = x*x;
139#ifdef DO_NOT_USE_THIS
140 r = z*(r00+z*(r01+z*(r02+z*r03)));
141 s = one+z*(s01+z*(s02+z*(s03+z*(s04+z*s05))));
142 r *= x;
143#else
144 r1 = z*R[0]; z2=z*z;
145 r2 = R[1]+z*R[2]; z4=z2*z2;
146 r = r1 + z2*r2 + z4*R[3];
147 r *= x;
148 s1 = one+z*S[1];
149 s2 = S[2]+z*S[3];
150 s3 = S[4]+z*S[5];
151 s = s1 + z2*s2 + z4*s3;
152#endif
153 return(x*0.5+r/s);
154}
INT32 int32_t
Definition: types.h:71
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLdouble * v
Definition: gl.h:2040
GLdouble s
Definition: gl.h:2039
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
const GLubyte * c
Definition: glext.h:8905
GLdouble GLdouble z
Definition: glext.h:5874
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
#define ss
Definition: i386-dis.c:441
static double huge
Definition: j1_y1.c:79
static double pone()
static double R[]
Definition: j1_y1.c:84
static double zero
Definition: j1_y1.c:97
static double invsqrtpi
Definition: j1_y1.c:81
static double qone()
static double one
Definition: j1_y1.c:80
static __inline void __sincos(double x, double *s, double *c)
Definition: ieee754.h:43
static __inline double __cos(double x)
Definition: ieee754.h:42
#define GET_HIGH_WORD(i, d)
Definition: ieee754.h:26
static __inline double __ieee754_sqrt(double x)
Definition: ieee754.h:40
_Check_return_ _CRT_JIT_INTRINSIC double __cdecl fabs(_In_ double x)
Definition: fabs.c:17
uint32_t cc
Definition: isohybrid.c:75
#define c
Definition: ke_i.h:80
struct S1 s1
struct S2 s2
static DNS_RECORDW r1
Definition: record.c:37
static DNS_RECORDW r2
Definition: record.c:38
Definition: movable.cpp:9

Referenced by __ieee754_jn(), __ieee754_y1(), and _j1().

◆ __ieee754_y1()

double __ieee754_y1 ( double  x)

Definition at line 182 of file j1_y1.c.

185{
186 double z, s,c,ss,cc,u,v,u1,u2,v1,v2,v3,z2,z4;
187 int32_t hx,ix,lx;
188
189 EXTRACT_WORDS(hx,lx,x);
190 ix = 0x7fffffff&hx;
191 /* if Y1(NaN) is NaN, Y1(-inf) is NaN, Y1(inf) is 0 */
192 if(ix>=0x7ff00000) return one/(x+x*x);
193 if((ix|lx)==0) return -HUGE_VAL+x; /* -inf and overflow exception. */;
194 if(hx<0) return zero/(zero*x);
195 if(ix >= 0x40000000) { /* |x| >= 2.0 */
196 __sincos (x, &s, &c);
197 ss = -s-c;
198 cc = s-c;
199 if(ix<0x7fe00000) { /* make sure x+x not overflow */
200 z = __cos(x+x);
201 if ((s*c)>zero) cc = z/ss;
202 else ss = z/cc;
203 }
204 /* y1(x) = sqrt(2/(pi*x))*(p1(x)*sin(x0)+q1(x)*cos(x0))
205 * where x0 = x-3pi/4
206 * Better formula:
207 * cos(x0) = cos(x)cos(3pi/4)+sin(x)sin(3pi/4)
208 * = 1/sqrt(2) * (sin(x) - cos(x))
209 * sin(x0) = sin(x)cos(3pi/4)-cos(x)sin(3pi/4)
210 * = -1/sqrt(2) * (cos(x) + sin(x))
211 * To avoid cancellation, use
212 * sin(x) +- cos(x) = -cos(2x)/(sin(x) -+ cos(x))
213 * to compute the worse one.
214 */
215 if(ix>0x48000000) z = (invsqrtpi*ss)/__ieee754_sqrt(x);
216 else {
217 u = pone(x); v = qone(x);
219 }
220 return z;
221 }
222 if(ix<=0x3c900000) { /* x < 2**-54 */
223 return(-tpi/x);
224 }
225 z = x*x;
226#ifdef DO_NOT_USE_THIS
227 u = U0[0]+z*(U0[1]+z*(U0[2]+z*(U0[3]+z*U0[4])));
228 v = one+z*(V0[0]+z*(V0[1]+z*(V0[2]+z*(V0[3]+z*V0[4]))));
229#else
230 u1 = U0[0]+z*U0[1];z2=z*z;
231 u2 = U0[2]+z*U0[3];z4=z2*z2;
232 u = u1 + z2*u2 + z4*U0[4];
233 v1 = one+z*V0[0];
234 v2 = V0[1]+z*V0[2];
235 v3 = V0[3]+z*V0[4];
236 v = v1 + z2*v2 + z4*v3;
237#endif
238 return(x*(u/v) + tpi*(__ieee754_j1(x)*__ieee754_log(x)-one/x));
239}
GLdouble GLdouble u2
Definition: glext.h:8308
GLfloat GLfloat GLfloat GLfloat v3
Definition: glext.h:6064
GLfloat GLfloat v1
Definition: glext.h:6062
GLfloat GLfloat GLfloat v2
Definition: glext.h:6063
GLdouble u1
Definition: glext.h:8308
static double U0[5]
Definition: j1_y1.c:159
static double V0[5]
Definition: j1_y1.c:170
static double tpi
Definition: j1_y1.c:82
double __ieee754_j1(double x)
Definition: j1_y1.c:103
#define EXTRACT_WORDS(ix0, ix1, d)
Definition: ieee754.h:16
static __inline double __ieee754_log(double x)
Definition: ieee754.h:41
#define HUGE_VAL
Definition: math.h:51

Referenced by __ieee754_yn(), and _y1().

◆ pone() [1/2]

static double pone ( )
static

Referenced by __ieee754_j1(), and __ieee754_y1().

◆ pone() [2/2]

static double pone ( double  x)
static

Definition at line 350 of file j1_y1.c.

353{
354#ifdef __STDC__
355 const double *p = 0,*q = 0;
356#else
357 double *p = 0,*q = 0;
358#endif
359 double z,r,s,r1,r2,r3,s1,s2,s3,z2,z4;
360 int32_t ix;
361 GET_HIGH_WORD(ix,x);
362 ix &= 0x7fffffff;
363 if(ix>=0x40200000) {p = pr8; q= ps8;}
364 else if(ix>=0x40122E8B){p = pr5; q= ps5;}
365 else if(ix>=0x4006DB6D){p = pr3; q= ps3;}
366 else if(ix>=0x40000000){p = pr2; q= ps2;}
367 z = one/(x*x);
368#ifdef DO_NOT_USE_THIS
369 r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
370 s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*q[4]))));
371#else
372 r1 = p[0]+z*p[1]; z2=z*z;
373 r2 = p[2]+z*p[3]; z4=z2*z2;
374 r3 = p[4]+z*p[5];
375 r = r1 + z2*r2 + z4*r3;
376 s1 = one+z*q[0];
377 s2 = q[1]+z*q[2];
378 s3 = q[3]+z*q[4];
379 s = s1 + z2*s2 + z4*s3;
380#endif
381 return one+ r/s;
382}
GLdouble GLdouble GLdouble GLdouble q
Definition: gl.h:2063
GLfloat GLfloat p
Definition: glext.h:8902
static double pr8[6]
Definition: j1_y1.c:254
static double pr2[6]
Definition: j1_y1.c:326
static double ps2[5]
Definition: j1_y1.c:338
static double ps5[5]
Definition: j1_y1.c:290
static double pr5[6]
Definition: j1_y1.c:278
static double ps8[5]
Definition: j1_y1.c:266
static double ps3[5]
Definition: j1_y1.c:314
static double pr3[6]
Definition: j1_y1.c:302
static DNS_RECORDW r3
Definition: record.c:39

◆ qone() [1/2]

static double qone ( )

Referenced by __ieee754_j1(), and __ieee754_y1().

◆ qone() [2/2]

static double qone ( double  x)
static

Definition at line 498 of file j1_y1.c.

501{
502#ifdef __STDC__
503 const double *p = 0,*q = 0;
504#else
505 double *p = 0,*q = 0;
506#endif
507 double s,r,z,r1,r2,r3,s1,s2,s3,z2,z4,z6;
508 int32_t ix;
509 GET_HIGH_WORD(ix,x);
510 ix &= 0x7fffffff;
511 if(ix>=0x40200000) {p = qr8; q= qs8;}
512 else if(ix>=0x40122E8B){p = qr5; q= qs5;}
513 else if(ix>=0x4006DB6D){p = qr3; q= qs3;}
514 else if(ix>=0x40000000){p = qr2; q= qs2;}
515 z = one/(x*x);
516#ifdef DO_NOT_USE_THIS
517 r = p[0]+z*(p[1]+z*(p[2]+z*(p[3]+z*(p[4]+z*p[5]))));
518 s = one+z*(q[0]+z*(q[1]+z*(q[2]+z*(q[3]+z*(q[4]+z*q[5])))));
519#else
520 r1 = p[0]+z*p[1]; z2=z*z;
521 r2 = p[2]+z*p[3]; z4=z2*z2;
522 r3 = p[4]+z*p[5]; z6=z4*z2;
523 r = r1 + z2*r2 + z4*r3;
524 s1 = one+z*q[0];
525 s2 = q[1]+z*q[2];
526 s3 = q[3]+z*q[4];
527 s = s1 + z2*s2 + z4*s3 + z6*q[5];
528#endif
529 return (.375 + r/s)/x;
530}
static double qs5[6]
Definition: j1_y1.c:435
static double qs2[6]
Definition: j1_y1.c:485
static double qr5[6]
Definition: j1_y1.c:423
static double qr2[6]
Definition: j1_y1.c:473
static double qr8[6]
Definition: j1_y1.c:398
static double qr3[6]
Definition: j1_y1.c:448
static double qs8[6]
Definition: j1_y1.c:410
static double qs3[6]
Definition: j1_y1.c:460

Variable Documentation

◆ huge

double huge = 1e300
static

Definition at line 79 of file j1_y1.c.

Referenced by __ieee754_j1().

◆ invsqrtpi

double invsqrtpi = 5.64189583547756279280e-01
static

Definition at line 81 of file j1_y1.c.

Referenced by __ieee754_j1(), and __ieee754_y1().

◆ one

double one = 1.0
static

Definition at line 80 of file j1_y1.c.

Referenced by __ieee754_j1(), __ieee754_y1(), pone(), and qone().

◆ pr2

double pr2[6]
static
Initial value:
= {
1.07710830106873743082e-07,
1.17176219462683348094e-01,
2.36851496667608785174e+00,
1.22426109148261232917e+01,
1.76939711271687727390e+01,
5.07352312588818499250e+00,
}

Definition at line 326 of file j1_y1.c.

Referenced by add_pending_rmdir(), and pone().

◆ pr3

double pr3[6]
static
Initial value:
= {
3.02503916137373618024e-09,
1.17186865567253592491e-01,
3.93297750033315640650e+00,
3.51194035591636932736e+01,
9.10550110750781271918e+01,
4.85590685197364919645e+01,
}

Definition at line 302 of file j1_y1.c.

Referenced by pone().

◆ pr5

double pr5[6]
static
Initial value:
= {
1.31990519556243522749e-11,
1.17187493190614097638e-01,
6.80275127868432871736e+00,
1.08308182990189109773e+02,
5.17636139533199752805e+02,
5.28715201363337541807e+02,
}

Definition at line 278 of file j1_y1.c.

Referenced by pone().

◆ pr8

double pr8[6]
static
Initial value:
= {
0.00000000000000000000e+00,
1.17187499999988647970e-01,
1.32394806593073575129e+01,
4.12051854307378562225e+02,
3.87474538913960532227e+03,
7.91447954031891731574e+03,
}

Definition at line 254 of file j1_y1.c.

Referenced by pone().

◆ ps2

double ps2[5]
static
Initial value:
= {
2.14364859363821409488e+01,
1.25290227168402751090e+02,
2.32276469057162813669e+02,
1.17679373287147100768e+02,
8.36463893371618283368e+00,
}

Definition at line 338 of file j1_y1.c.

Referenced by pone().

◆ ps3

double ps3[5]
static
Initial value:
= {
3.47913095001251519989e+01,
3.36762458747825746741e+02,
1.04687139975775130551e+03,
8.90811346398256432622e+02,
1.03787932439639277504e+02,
}

Definition at line 314 of file j1_y1.c.

Referenced by pone().

◆ ps5

double ps5[5]
static
Initial value:
= {
5.92805987221131331921e+01,
9.91401418733614377743e+02,
5.35326695291487976647e+03,
7.84469031749551231769e+03,
1.50404688810361062679e+03,
}

Definition at line 290 of file j1_y1.c.

Referenced by pone().

◆ ps8

double ps8[5]
static
Initial value:
= {
1.14207370375678408436e+02,
3.65093083420853463394e+03,
3.69562060269033463555e+04,
9.76027935934950801311e+04,
3.08042720627888811578e+04,
}

Definition at line 266 of file j1_y1.c.

Referenced by pone().

◆ qr2

double qr2[6]
static
Initial value:
= {
-1.78381727510958865572e-07,
-1.02517042607985553460e-01,
-2.75220568278187460720e+00,
-1.96636162643703720221e+01,
-4.23253133372830490089e+01,
-2.13719211703704061733e+01,
}

Definition at line 473 of file j1_y1.c.

Referenced by qone().

◆ qr3

double qr3[6]
static
Initial value:
= {
-5.07831226461766561369e-09,
-1.02537829820837089745e-01,
-4.61011581139473403113e+00,
-5.78472216562783643212e+01,
-2.28244540737631695038e+02,
-2.19210128478909325622e+02,
}

Definition at line 448 of file j1_y1.c.

Referenced by qone().

◆ qr5

double qr5[6]
static
Initial value:
= {
-2.08979931141764104297e-11,
-1.02539050241375426231e-01,
-8.05644828123936029840e+00,
-1.83669607474888380239e+02,
-1.37319376065508163265e+03,
-2.61244440453215656817e+03,
}

Definition at line 423 of file j1_y1.c.

Referenced by qone().

◆ qr8

double qr8[6]
static
Initial value:
= {
0.00000000000000000000e+00,
-1.02539062499992714161e-01,
-1.62717534544589987888e+01,
-7.59601722513950107896e+02,
-1.18498066702429587167e+04,
-4.84385124285750353010e+04,
}

Definition at line 398 of file j1_y1.c.

Referenced by qone().

◆ qs2

double qs2[6]
static
Initial value:
= {
2.95333629060523854548e+01,
2.52981549982190529136e+02,
7.57502834868645436472e+02,
7.39393205320467245656e+02,
1.55949003336666123687e+02,
-4.95949898822628210127e+00,
}

Definition at line 485 of file j1_y1.c.

Referenced by qone().

◆ qs3

double qs3[6]
static
Initial value:
= {
4.76651550323729509273e+01,
6.73865112676699709482e+02,
3.38015286679526343505e+03,
5.54772909720722782367e+03,
1.90311919338810798763e+03,
-1.35201191444307340817e+02,
}

Definition at line 460 of file j1_y1.c.

Referenced by qone().

◆ qs5

double qs5[6]
static
Initial value:
= {
8.12765501384335777857e+01,
1.99179873460485964642e+03,
1.74684851924908907677e+04,
4.98514270910352279316e+04,
2.79480751638918118260e+04,
-4.71918354795128470869e+03,
}

Definition at line 435 of file j1_y1.c.

Referenced by qone().

◆ qs8

double qs8[6]
static
Initial value:
= {
1.61395369700722909556e+02,
7.82538599923348465381e+03,
1.33875336287249578163e+05,
7.19657723683240939863e+05,
6.66601232617776375264e+05,
-2.94490264303834643215e+05,
}

Definition at line 410 of file j1_y1.c.

Referenced by qone().

◆ R

double R[]
static
Initial value:
= {-6.25000000000000000000e-02,
1.40705666955189706048e-03,
-1.59955631084035597520e-05,
4.96727999609584448412e-08}

Definition at line 84 of file j1_y1.c.

Referenced by __ieee754_j1().

◆ S

double S[]
static
Initial value:
= {0.0, 1.91537599538363460805e-02,
1.85946785588630915560e-04,
1.17718464042623683263e-06,
5.04636257076217042715e-09,
1.23542274426137913908e-11}

Definition at line 88 of file j1_y1.c.

◆ tpi

double tpi = 6.36619772367581382433e-01
static

Definition at line 82 of file j1_y1.c.

Referenced by __ieee754_y1().

◆ U0

double U0[5]
static
Initial value:
= {
-1.96057090646238940668e-01,
5.04438716639811282616e-02,
-1.91256895875763547298e-03,
2.35252600561610495928e-05,
-9.19099158039878874504e-08,
}

Definition at line 159 of file j1_y1.c.

Referenced by __ieee754_y1().

◆ V0

double V0[5]
static
Initial value:
= {
1.99167318236649903973e-02,
2.02552581025135171496e-04,
1.35608801097516229404e-06,
6.22741452364621501295e-09,
1.66559246207992079114e-11,
}

Definition at line 170 of file j1_y1.c.

Referenced by __ieee754_y1().

◆ zero

double zero = 0.0
static

Definition at line 97 of file j1_y1.c.

Referenced by __ieee754_j1(), and __ieee754_y1().