예제 #1
0
파일: xtrig.c 프로젝트: billw2012/BGalaxy1
static struct xpr
rred (struct xpr z, int kf, int *ps)
{
  struct xpr is, q;

  if (x_neg (&z))
    {
      z = xneg (z);
      is = xOne;
    }
  else
    is = xZero;
  z = xfmod (z, xPi, &q);
  if (kf == 't')
    q = is;
  else if (kf == 's')
    q = xadd (q, is, 0);
  if (xprcmp (&z, &xPi2) == 1)
    {
      z = xadd (xPi, z, 1);
      if (kf == 'c' || kf == 't')
	q = xadd (q, xOne, 0);
    }
  *ps = (xodd (q)) ? 1 : 0;
  return z;
}
예제 #2
0
파일: Hexagon.cpp 프로젝트: hobu/hexer
bool Hexagon::less(const Hexagon *h) const
{
    if (y() < h->y())
        return true;
    if (y() > h->y())
        return false;
    if (xeven() && h->xodd())
        return true;
    if (xodd() && h->xeven())
        return false;
    return x() < h->x();
}