aboutsummaryrefslogtreecommitdiff
path: root/src/tsfn.cpp
blob: fb299dc906e9a1ccd177ba0c98e871657e73fd60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* determine small t */
#include <math.h>
#include "proj.h"
#include "projects.h"

double pj_tsfn(double phi, double sinphi, double e) {
    double denominator;
    sinphi *= e;

    /* avoid zero division, fail gracefully */
    denominator = 1.0 + sinphi;
    if (denominator == 0.0)
        return HUGE_VAL;

    return (tan (.5 * (M_HALFPI - phi)) /
            pow((1. - sinphi) / (denominator), .5 * e));
}