14 #if !defined(GEOGRAPHICLIB_MATH_HPP) 15 #define GEOGRAPHICLIB_MATH_HPP 1 17 #if !defined(GEOGRAPHICLIB_WORDS_BIGENDIAN) 18 # define GEOGRAPHICLIB_WORDS_BIGENDIAN 0 21 #if !defined(GEOGRAPHICLIB_HAVE_LONG_DOUBLE) 22 # define GEOGRAPHICLIB_HAVE_LONG_DOUBLE 0 25 #if !defined(GEOGRAPHICLIB_PRECISION) 35 # define GEOGRAPHICLIB_PRECISION 2 42 #if GEOGRAPHICLIB_PRECISION == 4 44 # include <boost/version.hpp> 45 # include <boost/multiprecision/float128.hpp> 46 # include <boost/math/special_functions.hpp> 47 #elif GEOGRAPHICLIB_PRECISION >= 5 48 # if GEOGRAPHICLIB_PRECISION > 5 49 # define MPREAL_FIXED_PRECISION GEOGRAPHICLIB_PRECISION 51 # define MPREAL_FIXED_PRECISION 0 56 #if GEOGRAPHICLIB_PRECISION > 3 58 # define GEOGRAPHICLIB_VOLATILE 61 # define GEOGRAPHICLIB_PANIC(msg) \ 62 (throw GeographicLib::GeographicErr(msg), false) 64 # define GEOGRAPHICLIB_VOLATILE volatile 67 # define GEOGRAPHICLIB_PANIC(msg) false 88 #if GEOGRAPHICLIB_HAVE_LONG_DOUBLE 98 #if GEOGRAPHICLIB_PRECISION == 2 106 #elif GEOGRAPHICLIB_PRECISION == 1 108 #elif GEOGRAPHICLIB_PRECISION == 3 110 #elif GEOGRAPHICLIB_PRECISION == 4 111 typedef boost::multiprecision::float128
real;
112 #elif GEOGRAPHICLIB_PRECISION >= 5 113 typedef mpfr::mpreal
real;
142 static inline constexpr
int qd = 90;
143 static inline constexpr
int dm = 60;
144 static inline constexpr
int ms = 60;
145 static inline constexpr
int hd = 2 * qd;
146 static inline constexpr
int td = 2 * hd;
147 static inline constexpr
int ds = dm * ms;
165 static int set_digits(
int ndigits);
170 static int digits10();
176 static int extra_digits();
187 template<
typename T = real>
static T
pi() {
189 static const T pi = atan2(T(0), T(-1));
197 template<
typename T = real>
static T
degree() {
198 static const T degree = pi<T>() / T(hd);
209 template<
typename T>
static T
sq(T x)
219 template<
typename T>
static void norm(T& x, T& y) {
220 #if defined(_MSC_VER) && _MSC_VER < 1950 && defined(_M_IX86) 233 using std::sqrt; T h = sqrt(x * x + y * y);
235 using std::hypot; T h = hypot(x, y);
253 template<
typename T>
static T sum(T u, T v, T& t);
270 template<
typename T>
static T
polyval(
int N,
const T p[], T x) {
274 T z = N < 0 ? 0 : *p++;
275 while (--N >= 0) z = z * x + *p++;
293 template<
typename T>
static T AngNormalize(T x);
303 template<
typename T>
static T
LatFix(T x)
304 {
using std::fabs;
return fabs(x) > T(qd) ? NaN<T>() : x; }
323 template<
typename T>
static T AngDiff(T x, T y, T& e);
337 template<
typename T>
static T
AngDiff(T x, T y)
338 { T e;
return AngDiff(x, y, e); }
354 template<
typename T>
static T AngRound(T x);
369 template<
typename T>
static void sincosd(T x, T& sinx, T& cosx);
386 template<
typename T>
static void sincosde(T x, T t, T& sinx, T& cosx);
398 template<
typename T>
static T sind(T x);
409 template<
typename T>
static T cosd(T x);
421 template<
typename T>
static T tand(T x);
434 template<
typename T>
static T atan2d(T y, T x);
443 template<
typename T>
static T atand(T x);
457 template<
typename T>
static T eatanhe(T x, T es);
476 template<
typename T>
static T taupf(T tau, T es);
495 template<
typename T>
static T tauf(T taup, T es);
507 template<
typename T>
static T hypot3(T x, T y, T z);
522 template<
typename T>
static T clamp(T x, T a, T b);
530 template<
typename T = real>
static T NaN();
538 template<
typename T = real>
static T infinity();
547 template<
typename T>
static T
swab(T x) {
550 unsigned char c[
sizeof(T)];
553 for (
int i =
sizeof(T)/2; i--; )
554 std::swap(b.c[i], b.c[
sizeof(T) - 1 - i]);
562 #endif // GEOGRAPHICLIB_MATH_HPP
#define GEOGRAPHICLIB_EXPORT
#define GEOGRAPHICLIB_WORDS_BIGENDIAN
Mathematical functions needed by GeographicLib.
static void norm(T &x, T &y)
static T polyval(int N, const T p[], T x)
Namespace for GeographicLib.
static T AngDiff(T x, T y)
GeographicLib::Math::real real
void swap(GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &a, GeographicLib::NearestNeighbor< dist_t, pos_t, distfun_t > &b)
Header for GeographicLib::Constants class.