eLon static method

double eLon(
  1. double t,
  2. int n
)

Implementation

static double eLon(double t, int n) {
  t /= 10;
  double v = 0, tn = 1;
  int n1, n2;
  double m;
  double c;
  int pn = 1;
  double n0, m0 = XL0[pn + 1] - XL0[pn];
  for (int i = 0; i < 6; i++, tn *= t) {
    n1 = XL0[pn + i].floor();
    n2 = XL0[pn + 1 + i].floor();
    n0 = n2 * 1.0 - n1;
    if (n0 == 0) {
      continue;
    }
    if (n < 0) {
      m = n2 * 1.0;
    } else {
      m = (3 * n * n0 / m0 + 0.5).floorToDouble() + n1;
      if (i != 0) {
        m += 3;
      }
      if (m > n2) {
        m = n2 * 1.0;
      }
    }
    c = 0;
    for (int j = n1; j < m; j += 3) {
      c += XL0[j] * math.cos(XL0[j + 1] + t * XL0[j + 2]);
    }
    v += c * tn;
  }
  v /= XL0[0];
  double t2 = t * t;
  v +=
      (-0.0728 - 2.7702 * t - 1.1019 * t2 - 0.0996 * t2 * t) / SECOND_PER_RAD;
  return v;
}