\manpage {integer} {} {Integers of Arbitrary Length} 
 
\definition
An instance $a$ of the data type \name\ is an integer number of 
arbitrary length. 

 
\creation a 
 
\create { }
   { creates an instance \var\ of type \name\ and initializes it
with zero. }
 
 
\create {(int\ n)}
   { creates an instance \var\ of type \name\ and initializes it
with the value of $n$. }
 
 
\create {(unsigned\ int\ i)}
   { creates an instance \var\ of type \name\ and initializes it
with the value of $i$. }
 
 
\create {(double\ x)}
   { creates an instance \var\ of type \name\ and initializes it
with the integral part of $x$. }
 
 
\operations 2 4.7 
 


The arithmetic operations $+,\ -,\ *,\ /,\ +=,\
-=,\ *=,\ /=,\ -$(unary), $++,\ --$,  the modulus operation ($\%$, $\% =$), bitwise
AND ($\&$, $\& =$), bitwise OR ($|,\ | =$), the complement ($\ \tilde{}\ $),
the shift operations
($<<,\ >>$),
the comparison operations $<,\ <=,\ >,\ 
>=,\ ==,\ !=$ and the stream operations all are available.

 
\op  int    length {()}
           {  returns the number of bits of the representation of \var. }
 
 
\op  bool   islong {()}
           {  returns whether \var\ fits in the data type $long$. }
 
 
\op  bool   iszero {()}
           {  returns whether \var\ is equal to zero. }
 
 
\op  long   tolong {()}
           {  returns a $long$ number which is initialized with the value of
\var.\\ 
\precond $a$.islong() is $true$. }
 
 
\op  double todouble {()}
           {  returns a $double$ number which is initialized with the value of
\var. \\
\precond $a$ fits in the range of a $double$. }
 
 
\op  integer sqrt {()}
           {  returns the largest $integer$ which is not larger than the
squareroot of \var.  }
 
 

\smallskip
{\bf Non-member functions}
\smallskip 
 
\func  integer abs {( integer\ a)}
           {  returns the absolute value of $a$. }
 
 
\func  integer gcd {( integer\ a, \  integer\ b)}
           {  returns the greatest common divisor of $a$ and $b$. }
 
 
\func  int sign {( integer\ a)}
           {  returns the sign of $a$. }
 
 
\func  int log {( integer\ a)}
           {  returns the logarithm of $a$ to the basis 2. }
 
 
\implementation An $integer$ is essentially implemented by a 
vector $vec$ of $unsigned\ long$ numbers. 
The sign and the size are stored in extra variables.
Some time critical functions are also implemented in sparc assembler code.
 
