calcShuo static method

double calcShuo(
  1. double jd
)

Implementation

static double calcShuo(double jd) {
  int size = SHUO_KB.length;
  double d = 0;
  int pc = 14, i;
  jd += Solar.J2000;
  double f1 = SHUO_KB[0] - pc, f2 = SHUO_KB[size - 1] - pc, f3 = 2436935;
  if (jd < f1 || jd >= f3) {
    d = (shuoHigh(((jd + pc - 2451551) / 29.5306).floorToDouble() * PI_2) + 0.5).floorToDouble();
  } else if (jd >= f1 && jd < f2) {
    for (i = 0; i < size; i += 2) {
      if (jd + pc < SHUO_KB[i + 2]) {
        break;
      }
    }
    d = SHUO_KB[i] +
        SHUO_KB[i + 1] *
            ((jd + pc - SHUO_KB[i]) / SHUO_KB[i + 1]).floorToDouble();
    d = (d + 0.5).floorToDouble();
    if (d == 1683460) {
      d++;
    }
    d -= Solar.J2000;
  } else if (jd >= f2 && jd < f3) {
    d = (shuoLow(((jd + pc - 2451551) / 29.5306).floorToDouble() * PI_2) + 0.5).floorToDouble();
    int from = ((jd - f2) / 29.5306).floor();
    String n = _sb.substring(from, from + 1);
    if ('1' == n) {
      d += 1;
    } else if ('2' == n) {
      d -= 1;
    }
  }
  return d;
}