aboutsummaryrefslogtreecommitdiff
path: root/src/projections/merc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/projections/merc.cpp')
-rw-r--r--src/projections/merc.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/projections/merc.cpp b/src/projections/merc.cpp
index 472cb43f..e5da3967 100644
--- a/src/projections/merc.cpp
+++ b/src/projections/merc.cpp
@@ -13,7 +13,8 @@ PROJ_HEAD(webmerc, "Web Mercator / Pseudo Mercator") "\n\tCyl, Ell\n\t";
static PJ_XY merc_e_forward (PJ_LP lp, PJ *P) { /* Ellipsoidal, forward */
PJ_XY xy = {0.0,0.0};
xy.x = P->k0 * lp.lam;
- xy.y = P->k0 * (asinh(tan(lp.phi)) - P->e * atanh(P->e * sin(lp.phi)));
+ double sphi = sin(lp.phi), cphi = cos(lp.phi);
+ xy.y = P->k0 * (asinh(sphi/cphi) - P->e * atanh(P->e * sphi));
return xy;
}