Ejemplo n.º 1
0
CFix operator/(const Fix &x, const CFix &y)
{
  fixrep denominator = y.get_re() * y.get_re() + y.get_im() * y.get_im();
  return CFix(x.get_re() * y.get_re() / denominator,
              -x.get_re() * y.get_im() / denominator,
              x.get_shift() - y.get_shift(),
              0, 0);
}
Ejemplo n.º 2
0
CFix operator*(const Fix &x, const CFix &y)
{
  return CFix(x.get_re() * y.get_re(),
              x.get_re() * y.get_im(),
              x.get_shift() + y.get_shift(),
              0, 0);
}
Ejemplo n.º 3
0
CFix operator-(const Fix &x, const CFix &y)
{
  return CFix(x.get_re() - y.get_re(),
              -y.get_im(),
              assert_shifts(y, x),
              0, 0);
}
Ejemplo n.º 4
0
CFix operator/(const CFix &x, const Fix &y)
{
  return CFix(x.get_re() / y.get_re(),
              x.get_im() / y.get_re(),
              x.get_shift() - y.get_shift(),
              0, 0);
}
Ejemplo n.º 5
0
CFix operator+(const CFix &x, const Fix &y)
{
  return CFix(x.get_re() + y.get_re(),
              x.get_im(),
              assert_shifts(x, y),
              0, 0);
}
Ejemplo n.º 6
0
Fix operator+(const int x, const Fix &y)
{
  return Fix(x + y.get_re(),
             assert_shifts(y, x),
             0, 0);
}
Ejemplo n.º 7
0
Fix operator/(const Fix &x, const int y)
{
  return Fix(x.get_re() / y,
             x.get_shift(),
             0, 0);
}
Ejemplo n.º 8
0
Fix operator-(const Fix &x, const int y)
{
  return Fix(x.get_re() - y,
             assert_shifts(x, y),
             0, 0);
}
Ejemplo n.º 9
0
Fix operator/(const int x, const Fix &y)
{
  return Fix(x / y.get_re(),
             -y.get_shift(),
             0, 0);
}
Ejemplo n.º 10
0
Fix operator*(const int x, const Fix &y)
{
  return Fix(x * y.get_re(),
             y.get_shift(),
             0, 0);
}