blob: f75862a9ce6af6d2b4f55e796be7d49db6fa04a1 (
plain) (
tree)
|
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST
double
libtellurian_meridian_radius(double latitude)
{
latitude = radians(latitude);
return libtellurian_meridian_radius_radians(latitude);
}
#else
static int
approx(double a, double b)
{
return fabs(a - b) <= 1e-8 * (0.5 * (a + b));
}
int
main(void)
{
ASSERT(libtellurian_meridian_radius(0) == libtellurian_meridian_radius_radians(0));
ASSERT(approx(libtellurian_meridian_radius(180), libtellurian_meridian_radius_radians(0)));
ASSERT(approx(libtellurian_meridian_radius(360), libtellurian_meridian_radius_radians(0)));
ASSERT(approx(libtellurian_meridian_radius(90), libtellurian_meridian_radius(-90)));
ASSERT(approx(libtellurian_meridian_radius(90), libtellurian_meridian_radius(270)));
ASSERT(approx(libtellurian_meridian_radius(45), libtellurian_meridian_radius(-45)));
ASSERT(approx(libtellurian_meridian_radius(135), libtellurian_meridian_radius(45)));
ASSERT(approx(libtellurian_meridian_radius(-135), libtellurian_meridian_radius(135)));
ASSERT(libtellurian_meridian_radius(90) == libtellurian_meridian_radius_radians(D90));
ASSERT(libtellurian_meridian_radius(45) == libtellurian_meridian_radius_radians(D45));
ASSERT(libtellurian_meridian_radius(30) == libtellurian_meridian_radius_radians(D30));
return 0;
}
#endif
|