aboutsummaryrefslogblamecommitdiffstats
path: root/libtellurian_sea_level_radians.c
blob: a23b22219817a0abb7c73befacb38b056da0426f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
















                                                         
/* See LICENSE file for copyright and license details. */
#include "common.h"


double
libtellurian_sea_level_radians(double latitude)
{
	double a = LIBTELLURIAN_EQUATORIAL_RADIUS;
	double b = LIBTELLURIAN_POLAR_RADIUS;
	double c = cos(latitude);
	double s = sin(latitude);
	double x = a * c * a;
	double y = b * s * b;
	double num = fma(x, x, y * y);
	double denom = fma(x, c, y * s);
	return sqrt(num / denom);
}