Mathematical functions needed by GeographicLib. More...
#include <GeographicLib/Constants.hpp>
Public Types | |
typedef long double | extended |
typedef double | real |
Static Public Member Functions | |
template<typename T > | |
static T | pi () throw () |
static real | pi () throw () |
static extended | epi () throw () |
template<typename T > | |
static T | degree () throw () |
static real | degree () throw () |
static extended | edegree () throw () |
template<typename T > | |
static T | hypot (T x, T y) throw () |
template<typename T > | |
static T | expm1 (T x) throw () |
template<typename T > | |
static T | log1p (T x) throw () |
template<typename T > | |
static T | asinh (T x) throw () |
template<typename T > | |
static T | atanh (T x) throw () |
template<typename T > | |
static T | cbrt (T x) throw () |
template<typename T > | |
static bool | isfinite (T x) throw () |
template<typename T > | |
static T | NaN () throw () |
static real | NaN () throw () |
template<typename T > | |
static bool | isnan (T x) throw () |
template<typename T > | |
static T | infinity () throw () |
static real | infinity () throw () |
Mathematical functions needed by GeographicLib.
Define mathematical functions in order to localize system dependencies and to provide generic versions of the functions. In addition define a real type to be used by GeographicLib.
Definition at line 87 of file Constants.hpp.
typedef long double GeographicLib::Math::extended |
The extended precision type for real numbers, used for some testing. This is long double on computers with this type; otherwise it is double.
Definition at line 101 of file Constants.hpp.
typedef double GeographicLib::Math::real |
The real type for GeographicLib. Nearly all the testing has been done with real = double. However, the algorithms should also work with float and long double (where available).
Definition at line 112 of file Constants.hpp.
static T GeographicLib::Math::pi | ( | ) | throw () [inline, static] |
Definition at line 125 of file Constants.hpp.
static real GeographicLib::Math::pi | ( | ) | throw () [inline, static] |
A synonym for pi<real>().
Definition at line 131 of file Constants.hpp.
static extended GeographicLib::Math::epi | ( | ) | throw () [inline, static] |
DEPRECATED A synonym for pi<extened>().
Definition at line 135 of file Constants.hpp.
static T GeographicLib::Math::degree | ( | ) | throw () [inline, static] |
Definition at line 141 of file Constants.hpp.
static real GeographicLib::Math::degree | ( | ) | throw () [inline, static] |
A synonym for degree<real>().
Definition at line 145 of file Constants.hpp.
static extended GeographicLib::Math::edegree | ( | ) | throw () [inline, static] |
DEPRECATED A synonym for degree<extened>().
Definition at line 149 of file Constants.hpp.
static T GeographicLib::Math::hypot | ( | T | x, | |
T | y | |||
) | throw () [inline, static] |
The hypotenuse function avoiding underflow and overflow.
[in] | x | |
[in] | y |
Definition at line 160 of file Constants.hpp.
Referenced by asinh(), GeographicLib::TransverseMercator::Forward(), GeographicLib::PolarStereographic::Forward(), GeographicLib::Geodesic::GenInverse(), GeographicLib::TransverseMercator::Reverse(), GeographicLib::PolarStereographic::Reverse(), GeographicLib::LambertConformalConic::Reverse(), and GeographicLib::AlbersEqualArea::Reverse().
static T GeographicLib::Math::expm1 | ( | T | x | ) | throw () [inline, static] |
exp(x) - 1 accurate near x = 0. This is taken from N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd Edition (SIAM, 2002), Sec 1.14.1, p 19.
[in] | x |
Definition at line 201 of file Constants.hpp.
static T GeographicLib::Math::log1p | ( | T | x | ) | throw () [inline, static] |
log(x + 1) accurate near x = 0. This is taken See D. Goldberg, What every computer scientist should know about floating-point arithmetic (1991), Theorem 4. See also, Higham (op. cit.), Answer to Problem 1.5, p 528.
[in] | x |
Definition at line 236 of file Constants.hpp.
Referenced by asinh(), atanh(), and GeographicLib::LambertConformalConic::Reverse().
static T GeographicLib::Math::asinh | ( | T | x | ) | throw () [inline, static] |
The inverse hyperbolic sine function. This is defined in terms of Math::log1p(x) in order to maintain accuracy near x = 0. In addition, the odd parity of the function is enforced.
[in] | x |
Definition at line 268 of file Constants.hpp.
References hypot(), and log1p().
Referenced by GeographicLib::TransverseMercator::Forward(), and GeographicLib::LambertConformalConic::Forward().
static T GeographicLib::Math::atanh | ( | T | x | ) | throw () [inline, static] |
The inverse hyperbolic tangent function. This is defined in terms of Math::log1p(x) in order to maintain accuracy near x = 0. In addition, the odd parity of the function is enforced.
[in] | x |
Definition at line 295 of file Constants.hpp.
References log1p().
static T GeographicLib::Math::cbrt | ( | T | x | ) | throw () [inline, static] |
The cube root function.
[in] | x |
Definition at line 320 of file Constants.hpp.
static bool GeographicLib::Math::isfinite | ( | T | x | ) | throw () [inline, static] |
Test for finiteness.
[in] | x |
Definition at line 342 of file Constants.hpp.
Referenced by GeographicLib::DMS::Encode().
static T GeographicLib::Math::NaN | ( | ) | throw () [inline, static] |
The NaN (not a number)
Definition at line 358 of file Constants.hpp.
Referenced by GeographicLib::UTMUPS::Forward(), GeographicLib::Geodesic::GenInverse(), GeographicLib::UTMUPS::Reverse(), and GeographicLib::MGRS::Reverse().
static real GeographicLib::Math::NaN | ( | ) | throw () [inline, static] |
A synonym for NaN<real>().
Definition at line 366 of file Constants.hpp.
static bool GeographicLib::Math::isnan | ( | T | x | ) | throw () [inline, static] |
Test for NaN.
[in] | x |
Definition at line 375 of file Constants.hpp.
Referenced by GeographicLib::MGRS::Forward(), main(), GeographicLib::UTMUPS::Reverse(), and GeographicLib::UTMUPS::StandardZone().
static T GeographicLib::Math::infinity | ( | ) | throw () [inline, static] |
Infinity
Definition at line 389 of file Constants.hpp.
static real GeographicLib::Math::infinity | ( | ) | throw () [inline, static] |
A synonym for infinity<real>().
Definition at line 397 of file Constants.hpp.