public void Div(FixedPoint b) { const int tmpFrac = 8; // SS: temp. increase precision _value <<= tmpFrac; _value /= b._value; _value <<= FractionalBits - tmpFrac; }
public void TestDiv(float f1, float f2) { // Arrange var fp1 = new FixedPoint(f1); var fp2 = new FixedPoint(f2); // Act fp1.Div(fp2); // Assert Assert.AreEqual(f1 / f2, fp1.Float); }
public void Sub(FixedPoint b) { _value -= b._value; }
public void Mul(FixedPoint b) { _value *= b._value; _value >>= FractionalBits; }
public void Add(FixedPoint b) { _value += b._value; }