aboutsummaryrefslogtreecommitdiff
path: root/src/projections
diff options
context:
space:
mode:
Diffstat (limited to 'src/projections')
-rw-r--r--src/projections/merc.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/projections/merc.cpp b/src/projections/merc.cpp
index e5da3967..39685478 100644
--- a/src/projections/merc.cpp
+++ b/src/projections/merc.cpp
@@ -13,6 +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;
+ // Instead of calling tan and sin, call sin and cos which the compiler
+ // optimizes to a single call to sincos.
double sphi = sin(lp.phi), cphi = cos(lp.phi);
xy.y = P->k0 * (asinh(sphi/cphi) - P->e * atanh(P->e * sphi));
return xy;