|
static final int | digits = 53 |
|
static final double | epsilon = Math.pow(0.5, digits - 1) |
|
static final double | min = Math.pow(0.5, 1022) |
|
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.
◆ GeoMath()
net.sf.geographiclib.GeoMath.GeoMath |
( |
| ) |
|
|
inlineprivate |
◆ AngDiff()
static Pair net.sf.geographiclib.GeoMath.AngDiff |
( |
double |
x, |
|
|
double |
y |
|
) |
| |
|
inlinestatic |
The exact difference of two angles reduced to (−180°, 180°].
- Parameters
-
x | the first angle in degrees. |
y | the second angle in degrees. |
- Returns
- Pair(d, e) with d being the rounded difference and e being the error.
The computes z = y − x 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
-
- 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 |
◆ atan2d()
static double net.sf.geographiclib.GeoMath.atan2d |
( |
double |
y, |
|
|
double |
x |
|
) |
| |
|
inlinestatic |
Evaluate the atan2 function with the result in degrees
- Parameters
-
y | the sine of the angle |
x | the 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
-
- 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
-
- 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
-
x | gives the magitude of the result. |
y | gives 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
-
x | the first argument. |
y | the 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
-
- 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
-
- 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 |
◆ norm()
static Pair net.sf.geographiclib.GeoMath.norm |
( |
double |
sinx, |
|
|
double |
cosx |
|
) |
| |
|
inlinestatic |
◆ polyval()
static double net.sf.geographiclib.GeoMath.polyval |
( |
int |
N, |
|
|
double |
p[], |
|
|
int |
s, |
|
|
double |
x |
|
) |
| |
|
inlinestatic |
Evaluate a polynomial.
- Parameters
-
N | the order of the polynomial. |
p | the coefficient array (of size N + s + 1 or more). |
s | starting index for the array. |
x | the variable. |
- Returns
- the value of the polynomial.
Evaluate y = ∑n=0..N ps+n xN−n. 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
-
- 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
-
- 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
-
u | the first number in the sum. |
v | the 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.
◆ 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: