Example #1
0
        public IFixedArith <T> Multiply(IFixedArith <T> other)
        {
            long thisNumber = this.Number;

            thisNumber  *= other.Number;
            thisNumber >>= Fraction.Point;
            return(new Fixed <T>((int)thisNumber, false));
        }
Example #2
0
 public int CompareTo([AllowNull] IFixedArith <T> other)
 {
     if (this.Number < other.Number)
     {
         return(-1);
     }
     else if (this.Number == other.Number)
     {
         return(0);
     }
     else
     {
         return(1);
     }
 }
Example #3
0
 public bool Equals([AllowNull] IFixedArith <T> other)
 {
     return(this.Number == other.Number);
 }
Example #4
0
 public IFixedArith <T> Divide(IFixedArith <T> other)
 {
     return(new Fixed <T>((int)((((long)this.Number) << this.Fraction.Point) / other.Number), false));
 }
Example #5
0
 public IFixedArith <T> Add(IFixedArith <T> other)
 {
     return(new Fixed <T>(this.Number + other.Number, false));
 }
Example #6
0
 public IFixedArith <T> Subtract(IFixedArith <T> other)
 {
     return(new Fixed <T>(this.Number - other.Number, false));
 }