aboutsummaryrefslogtreecommitdiff
path: root/src/tsfn.cpp
blob: 32da09f2e502c5a7fa106411dbdb3ef5b1c7b2b6 (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 "proj_internal.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));
}