8 package net.sf.geographiclib;
26 public static final double epsilon = Math.pow(0.5, digits - 1);
31 public static final double min = Math.pow(0.5, 1022);
39 public static double sq(
double x) {
return x *
x; }
49 public static double hypot(
double x,
double y) {
50 x = Math.abs(x); y = Math.abs(y);
51 double a = Math.max(x, y),
b = Math.min(x, y) / (a != 0 ?
a : 1);
52 return a * Math.sqrt(1 +
b *
b);
71 public static double log1p(
double x) {
79 return z == 0 ?
x : x * Math.log(y) /
z;
90 public static double atanh(
double x) {
91 double y = Math.abs(x);
92 y = Math.log1p(2 * y/(1 - y))/2;
93 return x < 0 ? -
y :
y;
105 return Math.abs(x) * (y < 0 || (y == 0 && 1/y < 0) ? -1 : 1);
115 public static double cbrt(
double x) {
116 double y = Math.pow(Math.abs(x), 1/3.0);
117 return x < 0 ? -
y :
y;
120 public static Pair norm(
double sinx,
double cosx) {
121 double r =
hypot(sinx, cosx);
122 return new Pair(sinx/r, cosx/r);
141 double t = -(up + vpp);
144 return new Pair(s, t);
162 public static double polyval(
int N,
double p[],
int s,
double x) {
163 double y = N < 0 ? 0 : p[s++];
164 while (--N >= 0) y = y * x + p[s++];
175 final double z = 1/16.0;
176 if (x == 0)
return 0;
177 double y = Math.abs(x);
179 y = y < z ? z - (z -
y) : y;
180 return x < 0 ? -
y :
y;
193 return x <= -180 ? x + 360 : (x <= 180 ?
x : x - 360);
204 return Math.abs(x) > 90 ? Double.NaN :
x;
227 return sum(d == 180 && t > 0 ? -180 : d, t);
245 q = (
int)Math.floor(r / 90 + 0.5);
248 r = Math.toRadians(r);
250 double s = Math.sin(r),
c = Math.cos(r);
253 case 0: sinx =
s; cosx =
c;
break;
254 case 1: sinx =
c; cosx = -
s;
break;
255 case 2: sinx = -
s; cosx = -
c;
break;
256 default: sinx = -
c; cosx =
s;
break;
258 if (x != 0) { sinx += 0.0; cosx += 0.0; }
259 return new Pair(sinx, cosx);
280 if (Math.abs(y) > Math.abs(x)) {
double t; t =
x; x =
y; y =
t; q = 2; }
281 if (x < 0) { x = -
x; ++
q; }
283 double ang = Math.toDegrees(Math.atan2(y, x));
291 case 1: ang = (y >= 0 ? 180 : -180) - ang;
break;
292 case 2: ang = 90 - ang;
break;
293 case 3: ang = -90 + ang;
break;
305 return Math.abs(x) <= Double.MAX_VALUE;
static double polyval(int N, double p[], int s, double x)
static double hypot(double x, double y)
static boolean isfinite(double x)
static double log1p(double x)
static double atan2d(double y, double x)
static Pair norm(double sinx, double cosx)
Array< int, Dynamic, 1 > v
EIGEN_DEVICE_FUNC const Scalar & q
static double LatFix(double x)
static double copysign(double x, double y)
static Pair sum(double u, double v)
static double atanh(double x)
static Pair sincosd(double x)
static double AngRound(double x)
static double sq(double x)
static double cbrt(double x)
static double AngNormalize(double x)
static final double epsilon
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
static Pair AngDiff(double x, double y)