numerix_doc 0.4
integer_test.cpp
/******************************************************************************
* MODULE     : integer_test.cc
* DESCRIPTION: Test integer numbers
* COPYRIGHT  : (C) 2003  Joris van der Hoeven
*******************************************************************************
* This software falls under the GNU general public license and comes WITHOUT
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
* If you don't have this file, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/

#include <numerix/integer.hpp>
using namespace mmx;

void
integer_test () {
  integer x (111111111);
  integer y (1971);
  mmout << "x\t= " << x << "\n";
  mmout << "y\t= " << y << "\n";
  mmout << "x+y\t= " << (x+y) << "\n";
  mmout << "x-y\t= " << (x-y) << "\n";
  mmout << "x*y\t= " << (x*y) << "\n";
  mmout << "x quo y\t= " << quo (x, y) << "\n";
  mmout << "x rem y\t= " << rem (x, y) << "\n";
  mmout << "x+=y\t= " << (x+=y) << "\n";
  mmout << "x-=y\t= " << (x-=y) << "\n";
  mmout << "x*=y\t= " << (x*=y) << "\n";
  mmout << "x<<3\t= " << (x<<3) << "\n";
  mmout << "x>>3\t= " << (x>>3) << "\n";
  //mmout << "x<<=3\t= " << (x<<=3) << "\n";
  //mmout << "x>>=3\t= " << (x>>=3) << "\n";
  mmout << "x^2\t= " << pow(x,2) << "\n";
  mmout << "x^7\t= " << pow(x,7) << "\n";
  mmout << "sqrt(x^2)\t= " << sqrt(pow(x,2)) << "\n";
  mmout << "x=y\t= " << (x==y) << "\n";
  mmout << "x!=y\t= " << (x!=y) << "\n";
  mmout << "x<y\t= " << (x<y) << "\n";
  mmout << "x<=y\t= " << (x<=y) << "\n";
  mmout << "x>y\t= " << (x>y) << "\n";
  mmout << "x>=y\t= " << (x>=y) << "\n";
}
  
int
main () {
  try {
    integer_test ();
  }
  catch (exception& e) {
    mmout << "ERROR in integer_test: " << e << "\n";
    return -1;
  }
  return 0;
}
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines