Пример #1
0
IOperand		*Operand<T>::operator%(const IOperand &rhs) const
{
  IOperand              *ptr;


  if (rhs.getPrecision() >= Float || this->getPrecision() >= Float)
    {
      double            value;

      if (getValueD(rhs.toString()) == 0)
	throw Erreur(DivByZero);
      value = fmod(getValueD(this->toString()), getValueD(rhs.toString()));
      if (this->getPrecision() >= rhs.getPrecision())
        ptr = factory::new_operand(value, this->getType());
      else
        ptr = factory::new_operand(value, rhs.getType());
    }
  else
    {
      S32               value;

      if (getValueI(rhs.toString()) == 0)
	throw Erreur(DivByZero);
      value = check_modulo(*this, rhs);
      if (this->getPrecision() >= rhs.getPrecision())
        ptr = factory::new_operand(value, this->getType());
      else
        ptr = factory::new_operand(value, rhs.getType());
    }
  return ptr;

}
Пример #2
0
int
main (int argc, char **argv)
{
  int reps = 100000;

  tests_start ();
  mp_trace_base = -16;

  if (argc == 2)
     reps = atoi (argv[1]);

  check_modulo ();
  check_sqrt (reps);

  tests_end ();
  exit (0);
}