Skip to content

Commit

Permalink
Reduce rounds to save time
Browse files Browse the repository at this point in the history
  • Loading branch information
Wetitpig committed Sep 5, 2020
1 parent d895e73 commit a805a5f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/mpblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ long double meridian_arc(long double lat0, long double lat1)
c += sqr(double_fac(2 * j - 3) / double_fac(2 * j) * powl(FLAT_3, j));
m = c * (lat1 - lat0);

for (k = 1; k < 6; k++) {
for (k = 1; k < 11; k++) {
c = 0;
for (j = 0; j < 11; j++)
c += double_fac(2 * j - 3) / double_fac(2 * j) * double_fac(2 * j + 2 * k - 3) / double_fac(2 * j + 2 * k) * powl(FLAT_3, k + 2 * j);
c /= k;
c *= powl(-1.0l, k) * (1 - sqr(2 * k));
c *= powl(-1.0l, k) * (1 - sqr(2 * k)) / k;
m += c * (sin(2.0l * k * lat1) - sin(2.0l * k * lat0));
}

Expand Down
2 changes: 1 addition & 1 deletion src/vincenty.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ long double helmertA(long double calp)
usq = calp * ECC2;
k1 = sqrtl(1.0l + usq);
k1 = (k1 - 1.0l) / (k1 + 1.0l);
for (k = 0; k < 11; k++)
for (k = 0; k < 8; k++)
A += sqr(double_fac(2 * k - 3) / double_fac(2 * k) * powl(k1, k));
A /= (1 - k1);
return A;
Expand Down

0 comments on commit a805a5f

Please sign in to comment.