aboutsummaryrefslogtreecommitdiff
path: root/src/tsfn.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tsfn.cpp')
-rw-r--r--src/tsfn.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tsfn.cpp b/src/tsfn.cpp
new file mode 100644
index 00000000..ea3b896d
--- /dev/null
+++ b/src/tsfn.cpp
@@ -0,0 +1,16 @@
+/* determine small t */
+#include <math.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));
+}