Mathematical functions needed by GeographicLib. More...
#include <GeographicLib/Constants.hpp>
Public Types | |
typedef double | real |
Static Public Member Functions | |
static real | hypot (real x, real y) throw () |
static real | expm1 (real x) throw () |
static real | log1p (real x) throw () |
static real | asinh (real x) throw () |
static real | atanh (real x) throw () |
static real | cbrt (real x) throw () |
static bool | isfinite (real x) 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 66 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 81 of file Constants.hpp.
Return sqrt(x2 + y2) avoiding underflow and overflow.
Definition at line 95 of file Constants.hpp.
Referenced by asinh(), GeographicLib::TransverseMercator::Forward(), GeographicLib::GeodesicLine::Position(), GeographicLib::TransverseMercator::Reverse(), GeographicLib::PolarStereographic::Reverse(), GeographicLib::LambertConformalConic::Reverse(), and GeographicLib::Geocentric::Reverse().
Return 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.
Definition at line 126 of file Constants.hpp.
Referenced by GeographicLib::LambertConformalConic::Forward().
Return 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.
Definition at line 154 of file Constants.hpp.
Referenced by asinh(), atanh(), and GeographicLib::LambertConformalConic::Reverse().
Return asinh(x). 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.
Definition at line 179 of file Constants.hpp.
References hypot(), and log1p().
Referenced by GeographicLib::TransverseMercator::Forward().
Return atanh(x). 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.
Definition at line 199 of file Constants.hpp.
References log1p().
Return the real cube root of x.
Definition at line 217 of file Constants.hpp.
Referenced by GeographicLib::Geocentric::Reverse().
static bool GeographicLib::Math::isfinite | ( | real | x | ) | throw () [inline, static] |
Return true if number is finite, false if NaN or infinite.
Definition at line 232 of file Constants.hpp.