62 double a,
b,
c,
e, temp;
63 double lphi,
t,
E, denom, npio2;
80 lphi = lphi - npio2 *
M_PI_2;
100 double m11= (((((-7.0/2816.0)*
m + (5.0/1056.0))*
m - (7.0/2640.0))*
m
101 + (17.0/41580.0))*
m - (1.0/155925.0))*
m;
102 double m9 = ((((-5.0/1152.0)*
m + (1.0/144.0))*
m - (1.0/360.0))*
m
104 double m7 = ((-
m/112.0 + (1.0/84.0))*
m - (1.0/315.0))*
m;
105 double m5 = (-
m/40.0 + (1.0/30))*
m;
107 double p2 = lphi * lphi;
109 temp = ((((m11*
p2 + m9)*
p2 + m7)*
p2 + m5)*
p2 +
m3)*
p2*lphi + lphi;
116 if (
fabs(
t) > 10.0) {
120 if (
fabs(
e) < 10.0) {
134 lphi = lphi +
atan(
t * temp) + mod *
M_PI;
135 denom = 1 - temp *
t *
t;
137 t =
t * (1.0 + temp) / denom;
165 #define MAX3(a, b, c) (a > b ? (a > c ? a : c) : (b > c ? b : c))
190 double A0f, Af, Xf, Yf, Zf, E2f, E3f, scalef;
191 double A0d, Ad, seriesn, seriesd, Xd, Yd, Zd, E2d, E3d, E4d, E5d, scaled;
193 double mpp = (
m*phi)*phi;
195 if (-mpp < 1
e-6 && phi < -
m) {
196 return phi + (mpp*phi*phi/30.0 - mpp*mpp/40.0 - mpp/6.0)*phi;
200 double sm =
sqrt(-
m);
201 double sp =
sin(phi);
202 double cp =
cos(phi);
205 double b1 =
log(4*sp*sm/(1+cp));
206 double b = -(0.5 +
b1) / 2.0 /
m;
207 double c = (0.75 + cp/sp/sp -
b1) / 16.0 /
m /
m;
208 return (
a +
b +
c) * sm;
211 if (phi > 1
e-153 &&
m > -1e200) {
213 double csc2 = 1.0 /
s /
s;
222 scaled = mpp * phi / 3.0;
228 if (
x ==
y &&
x ==
z) {
229 return (scalef + scaled/
x)/
sqrt(
x);
232 A0f = (
x +
y +
z) / 3.0;
234 A0d = (
x +
y + 3.0*
z) / 5.0;
236 x1 =
x;
y1 =
y;
z1 =
z; seriesd = 0.0; seriesn = 1.0;
245 double lam = sx*sy + sx*sz + sy*sz;
246 seriesd += seriesn / (sz * (
z1 + lam));
247 x1 = (
x1 + lam) / 4.0;
248 y1 = (
y1 + lam) / 4.0;
249 z1 = (
z1 + lam) / 4.0;
250 Af = (
x1 +
y1 +
z1) / 3.0;
251 Ad = (Ad + lam) / 4.0;
257 Xf = (A0f -
x) / Af / (1 << 2*
n);
258 Yf = (A0f -
y) / Af / (1 << 2*
n);
264 ret = scalef * (1.0 - E2f/10.0 + E3f/14.0 + E2f*E2f/24.0
265 - 3.0*E2f*E3f/44.0) /
sqrt(Af);
267 Xd = (A0d -
x) / Ad / (1 << 2*
n);
268 Yd = (A0d -
y) / Ad / (1 << 2*
n);
271 E2d = Xd*Yd - 6.0*Zd*Zd;
272 E3d = (3*Xd*Yd - 8.0*Zd*Zd)*Zd;
273 E4d = 3.0*(Xd*Yd - Zd*Zd)*Zd*Zd;
274 E5d = Xd*Yd*Zd*Zd*Zd;
276 ret -= scaled * (1.0 - 3.0*E2d/14.0 + E3d/6.0 + 9.0*E2d*E2d/88.0
277 - 3.0*E4d/22.0 - 9.0*E2d*E3d/52.0 + 3.0*E5d/26.0)
278 /(1 << 2*
n) / Ad /
sqrt(Ad);
279 ret -= 3.0 * scaled * seriesd;