コード例 #1
0
ファイル: Fixed.cs プロジェクト: lunakv/Skola
 /// <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
     });
 }
コード例 #2
0
 public Fixed <T> Divide(Fixed <T> q)
 {
     return(new Fixed <T>(precision.Divide(fixedPointNumber, q.fixedPointNumber), true));
 }
コード例 #3
0
ファイル: Fixed.cs プロジェクト: lunakv/Skola
 /// <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
     });
 }
コード例 #4
0
 public Fixed <T> Subtract(Fixed <T> q)
 {
     return(new Fixed <T>(precision.Subtract(fixedPointNumber, q.fixedPointNumber), true));
 }
コード例 #5
0
 public Fixed <T> Multiply(Fixed <T> q)
 {
     return(new Fixed <T>(precision.Multiply(fixedPointNumber, q.fixedPointNumber), true));
 }
コード例 #6
0
 public Fixed <T> DivideWithoutLong(Fixed <T> f) =>
 new Fixed <T>((int)(((long)this.Value << LowerBits) / f.Value), change: false);
コード例 #7
0
 public Fixed <T> Add(Fixed <T> q)
 {
     return(new Fixed <T>(precision.Add(fixedPointNumber, q.fixedPointNumber), true));
 }
コード例 #8
0
 public Fixed <T> MultiplyWithoutLong(Fixed <T> f) =>
 new Fixed <T>((int)(((long)this.Value * f.Value) >> LowerBits), change: false);
コード例 #9
0
 public Fixed <T> Divide(Fixed <T> f) =>
 new Fixed <T>(((long)this.Value << LowerBits) / f.Value);
コード例 #10
0
 public Fixed <T> Multiply(Fixed <T> f) =>
 new Fixed <T>(((long)this.Value * f.Value) >> LowerBits);
コード例 #11
0
 public Fixed <T> SubtractWithoutLong(Fixed <T> f) =>
 new Fixed <T>(this.Value - f.Value, change: false);
コード例 #12
0
 public Fixed <T> Subtract(Fixed <T> f) =>
 new Fixed <T>((long)this.Value - f.Value);
コード例 #13
0
 public Fixed <T> AddWithoutLong(Fixed <T> f) =>
 new Fixed <T>(this.Value + f.Value, change: false);
コード例 #14
0
 public Fixed <T> Add(Fixed <T> f) =>
 new Fixed <T>((long)this.Value + f.Value);