aboutsummaryrefslogtreecommitdiffstats
path: root/libtellurian_elevated_gravity_radians.c
blob: ffd1a5b76d9bf49046d042563cca4ee973527084 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* See LICENSE file for copyright and license details. */
#include "common.h"


double
libtellurian_elevated_gravity_radians(double gravity, double latitude, double altitude)
{
	double k1 = -3.1570429877205807e-07;
	double k2 = 2.1026896504579084e-09;
	double k3 = -7.374516772941995e-14;
	double sin2_phi = sin(latitude) * sin(latitude);
	double f = fma(k3, altitude, fma(k2, sin2_phi, k1));
	return fma(f * altitude, gravity, gravity);
}