ln3 Operators

The following table lists the operators defined, with some brief notes about usage and limitations.

Operation Operators Footnotes Other Notes
Addition
+  +=  ++
1, 4  
Subtraction
-  -=  --
1, 4  
Multiplication
*  *=
1, 4  
Division
/  /=  %  %=
   
Assignment
=
1, 3  
Comparision
==  !=  <  >  <=  >=
1, 4  
Unary
-  +
   
Bitwise
&  &=  |  |=  ^  ^=  
   
~
  The ones compliment operator (~) only flips the bits of the existing digits of a number.  Because of this, ~0 == 0.  This should be fixed.  The probable solution would be to have this operator extend the ln out to the maximum number of digits, and flip.  This would be consistent with the integer PODs.
>>  >>=  <<  <<=
   
Stream
<<  >>
  iostream insertion and extraction operators.
Footnotes
  1. Right operand can be a scalar (short, int, long).
  2. Right operand can be long long.
  3. Right operand can be character pointer (char *).
  4. Scalar operands are commutative. (see note below)
Commutative scalar operands
The left operand of a member operator must, by defintion, be of the type that defines the operator.  That is, if the class ln defines an addition member operator:
ln ln::operator+( long x );

then there must be an ln to the left of the plus sign, and a long to the right of it:

ln x = "29837192398172983712";
long y = 3987423L;
ln z;
z = x + y;  //  OK
z = y + x;  //  Not OK!  Syntax error.

For those operators marked above as having commuted operators, overloaded non-member operators have been created so that both expressions in the example above are legal.