aboutsummaryrefslogtreecommitdiff
path: root/src/gauss.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gauss.cpp')
-rw-r--r--src/gauss.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gauss.cpp b/src/gauss.cpp
index b7a27191..49ccfa1c 100644
--- a/src/gauss.cpp
+++ b/src/gauss.cpp
@@ -65,9 +65,14 @@ void *pj_gauss_ini(double e, double phi0, double *chi, double *rc) {
}
*chi = asin(sphi / en->C);
en->ratexp = 0.5 * en->C * e;
- en->K = tan(.5 * *chi + M_FORTPI) / (
- pow(tan(.5 * phi0 + M_FORTPI), en->C) *
- srat(en->e * sphi, en->ratexp) );
+ if( .5 * phi0 + M_FORTPI < 1e-10 ) {
+ en->K = 1.0 / srat(en->e * sphi, en->ratexp);
+ }
+ else {
+ en->K = tan(.5 * *chi + M_FORTPI) / (
+ pow(tan(.5 * phi0 + M_FORTPI), en->C) *
+ srat(en->e * sphi, en->ratexp) );
+ }
return ((void *)en);
}