Static Public Member Functions | Static Public Attributes | Private Member Functions | List of all members
net.sf.geographiclib.GeoMath Class Reference

Static Public Member Functions

static Pair AngDiff (double x, double y)
 
static double AngNormalize (double x)
 
static double AngRound (double x)
 
static double atan2d (double y, double x)
 
static double atanh (double x)
 
static double cbrt (double x)
 
static double copysign (double x, double y)
 
static double hypot (double x, double y)
 
static boolean isfinite (double x)
 
static double LatFix (double x)
 
static double log1p (double x)
 
static Pair norm (double sinx, double cosx)
 
static double polyval (int N, double p[], int s, double x)
 
static Pair sincosd (double x)
 
static double sq (double x)
 
static Pair sum (double u, double v)
 

Static Public Attributes

static final int digits = 53
 
static final double epsilon = Math.pow(0.5, digits - 1)
 
static final double min = Math.pow(0.5, 1022)
 

Private Member Functions

 GeoMath ()
 

Detailed Description

Mathematical functions needed by GeographicLib.

Define mathematical functions and constants so that any version of Java can be used.

Definition at line 16 of file GeoMath.java.

Constructor & Destructor Documentation

◆ GeoMath()

net.sf.geographiclib.GeoMath.GeoMath ( )
inlineprivate

Definition at line 308 of file GeoMath.java.

Member Function Documentation

◆ AngDiff()

static Pair net.sf.geographiclib.GeoMath.AngDiff ( double  x,
double  y 
)
inlinestatic

The exact difference of two angles reduced to (−180°, 180°].

Parameters
xthe first angle in degrees.
ythe second angle in degrees.
Returns
Pair(d, e) with d being the rounded difference and e being the error.

The computes z = yx exactly, reduced to (−180°, 180°]; and then sets z = d + e where d is the nearest representable number to z and e is the truncation error. If d = −180, then e > 0; If d = 180, then e ≤ 0.

Definition at line 221 of file GeoMath.java.

◆ AngNormalize()

static double net.sf.geographiclib.GeoMath.AngNormalize ( double  x)
inlinestatic

Normalize an angle (restricted input range).

Parameters
xthe angle in degrees.
Returns
the angle reduced to the range [−180°, 180°).

The range of x is unrestricted.

Definition at line 191 of file GeoMath.java.

◆ AngRound()

static double net.sf.geographiclib.GeoMath.AngRound ( double  x)
inlinestatic

Definition at line 168 of file GeoMath.java.

◆ atan2d()

static double net.sf.geographiclib.GeoMath.atan2d ( double  y,
double  x 
)
inlinestatic

Evaluate the atan2 function with the result in degrees

Parameters
ythe sine of the angle
xthe cosine of the angle
Returns
atan2(y, x) in degrees.

The result is in the range (−180° 180°]. N.B., atan2d(±0, −1) = +180°; atan2d(−ε, −1) = −180°, for ε positive and tiny; atan2d(±0, 1) = ±0°.

Definition at line 274 of file GeoMath.java.

◆ atanh()

static double net.sf.geographiclib.GeoMath.atanh ( double  x)
inlinestatic

The inverse hyperbolic tangent function. This is defined in terms of GeoMath.log1p(x) in order to maintain accuracy near x = 0. In addition, the odd parity of the function is enforced.

Parameters
xthe argument.
Returns
atanh(x).

Definition at line 90 of file GeoMath.java.

◆ cbrt()

static double net.sf.geographiclib.GeoMath.cbrt ( double  x)
inlinestatic

The cube root function. In Java version 1.5 and later, Math.cbrt can be used.

Parameters
xthe argument.
Returns
the real cube root of x.

Definition at line 115 of file GeoMath.java.

◆ copysign()

static double net.sf.geographiclib.GeoMath.copysign ( double  x,
double  y 
)
inlinestatic

Copy the sign. In Java version 1.6 and later, Math.copysign can be used.

Parameters
xgives the magitude of the result.
ygives the sign of the result.
Returns
value with the magnitude of x and with the sign of y.

Definition at line 104 of file GeoMath.java.

◆ hypot()

static double net.sf.geographiclib.GeoMath.hypot ( double  x,
double  y 
)
inlinestatic

The hypotenuse function avoiding underflow and overflow. In Java version 1.5 and later, Math.hypot can be used.

Parameters
xthe first argument.
ythe second argument.
Returns
sqrt(x2 + y2).

Definition at line 49 of file GeoMath.java.

◆ isfinite()

static boolean net.sf.geographiclib.GeoMath.isfinite ( double  x)
inlinestatic

Test for finiteness.

Parameters
xthe argument.
Returns
true if number is finite, false if NaN or infinite.

Definition at line 304 of file GeoMath.java.

◆ LatFix()

static double net.sf.geographiclib.GeoMath.LatFix ( double  x)
inlinestatic

Normalize a latitude.

Parameters
xthe angle in degrees.
Returns
x if it is in the range [−90°, 90°], otherwise return NaN.

Definition at line 203 of file GeoMath.java.

◆ log1p()

static double net.sf.geographiclib.GeoMath.log1p ( double  x)
inlinestatic

log(1 + x) accurate near x = 0. In Java version 1.5 and later, Math.log1p can be used.

This is taken from D. Goldberg, What every computer scientist should know about floating-point arithmetic (1991), Theorem 4. See also, N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd Edition (SIAM, 2002), Answer to Problem 1.5, p 528.

Parameters
xthe argument.
Returns
log(1 + x).

Definition at line 71 of file GeoMath.java.

◆ norm()

static Pair net.sf.geographiclib.GeoMath.norm ( double  sinx,
double  cosx 
)
inlinestatic

Definition at line 120 of file GeoMath.java.

◆ polyval()

static double net.sf.geographiclib.GeoMath.polyval ( int  N,
double  p[],
int  s,
double  x 
)
inlinestatic

Evaluate a polynomial.

Parameters
Nthe order of the polynomial.
pthe coefficient array (of size N + s + 1 or more).
sstarting index for the array.
xthe variable.
Returns
the value of the polynomial.

Evaluate y = ∑n=0..N ps+n xNn. Return 0 if N < 0. Return ps, if N = 0 (even if x is infinite or a nan). The evaluation uses Horner's method.

Definition at line 162 of file GeoMath.java.

◆ sincosd()

static Pair net.sf.geographiclib.GeoMath.sincosd ( double  x)
inlinestatic

Evaluate the sine and cosine function with the argument in degrees

Parameters
xin degrees.
Returns
Pair(s, t) with s = sin(x) and c = cos(x).

The results obey exactly the elementary properties of the trigonometric functions, e.g., sin 9° = cos 81° = − sin 123456789°.

Definition at line 240 of file GeoMath.java.

◆ sq()

static double net.sf.geographiclib.GeoMath.sq ( double  x)
inlinestatic

Square a number.

Parameters
xthe argument.
Returns
x2.

Definition at line 39 of file GeoMath.java.

◆ sum()

static Pair net.sf.geographiclib.GeoMath.sum ( double  u,
double  v 
)
inlinestatic

The error-free sum of two numbers.

Parameters
uthe first number in the sum.
vthe second number in the sum.
Returns
Pair(s, t) with s = round(u + v) and t = u + v - s.

See D. E. Knuth, TAOCP, Vol 2, 4.2.2, Theorem B.

Definition at line 135 of file GeoMath.java.

Member Data Documentation

◆ digits

final int net.sf.geographiclib.GeoMath.digits = 53
static

The number of binary digits in the fraction of a double precision number (equivalent to C++'s

numeric_limits<double>::digits

).

Definition at line 21 of file GeoMath.java.

◆ epsilon

final double net.sf.geographiclib.GeoMath.epsilon = Math.pow(0.5, digits - 1)
static

Equivalent to C++'s

. In Java version 1.5 and later, Math.ulp(1.0) can be used.

Definition at line 26 of file GeoMath.java.

◆ min

final double net.sf.geographiclib.GeoMath.min = Math.pow(0.5, 1022)
static

Equivalent to C++'s

. In Java version 1.6 and later, Double.MIN_NORMAL can be used.

Definition at line 31 of file GeoMath.java.


The documentation for this class was generated from the following file:
epsilon
static double epsilon
Definition: testRot3.cpp:37
min
#define min(a, b)
Definition: datatypes.h:19


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:53:09