Exemplo n.º 1
0
 /// <summary>
 /// Subtracts one Fixed number from another
 /// </summary>
 /// <param name="other">
 /// Number to be subtracted from caller
 /// </param>
 /// <returns>
 /// New Fixed<T> instance with the subtracted value
 /// </returns>
 public Fixed <T> Subtract(Fixed <T> other)
 {
     return(new Fixed <T> {
         value = this.value - other.value
     });
 }
Exemplo n.º 2
0
 public Fixed <T> Divide(Fixed <T> q)
 {
     return(new Fixed <T>(precision.Divide(fixedPointNumber, q.fixedPointNumber), true));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds two Fixed numbers of the same type together
 /// </summary>
 /// <param name="other">
 /// Number to be added to caller
 /// </param>
 /// <returns>
 /// New Fixed<T> instance with the added value
 /// </returns>
 public Fixed <T> Add(Fixed <T> other)
 {
     return(new Fixed <T> {
         value = this.value + other.value
     });
 }
Exemplo n.º 4
0
 public Fixed <T> Subtract(Fixed <T> q)
 {
     return(new Fixed <T>(precision.Subtract(fixedPointNumber, q.fixedPointNumber), true));
 }
Exemplo n.º 5
0
 public Fixed <T> Multiply(Fixed <T> q)
 {
     return(new Fixed <T>(precision.Multiply(fixedPointNumber, q.fixedPointNumber), true));
 }
Exemplo n.º 6
0
 public Fixed <T> DivideWithoutLong(Fixed <T> f) =>
 new Fixed <T>((int)(((long)this.Value << LowerBits) / f.Value), change: false);
Exemplo n.º 7
0
 public Fixed <T> Add(Fixed <T> q)
 {
     return(new Fixed <T>(precision.Add(fixedPointNumber, q.fixedPointNumber), true));
 }
Exemplo n.º 8
0
 public Fixed <T> MultiplyWithoutLong(Fixed <T> f) =>
 new Fixed <T>((int)(((long)this.Value * f.Value) >> LowerBits), change: false);
Exemplo n.º 9
0
 public Fixed <T> Divide(Fixed <T> f) =>
 new Fixed <T>(((long)this.Value << LowerBits) / f.Value);
Exemplo n.º 10
0
 public Fixed <T> Multiply(Fixed <T> f) =>
 new Fixed <T>(((long)this.Value * f.Value) >> LowerBits);
Exemplo n.º 11
0
 public Fixed <T> SubtractWithoutLong(Fixed <T> f) =>
 new Fixed <T>(this.Value - f.Value, change: false);
Exemplo n.º 12
0
 public Fixed <T> Subtract(Fixed <T> f) =>
 new Fixed <T>((long)this.Value - f.Value);
Exemplo n.º 13
0
 public Fixed <T> AddWithoutLong(Fixed <T> f) =>
 new Fixed <T>(this.Value + f.Value, change: false);
Exemplo n.º 14
0
 public Fixed <T> Add(Fixed <T> f) =>
 new Fixed <T>((long)this.Value + f.Value);