Example #1
0
        public void Div(FixedPoint b)
        {
            const int tmpFrac = 8;

            // SS: temp. increase precision
            _value <<= tmpFrac;
            _value  /= b._value;
            _value <<= FractionalBits - tmpFrac;
        }
Example #2
0
            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);
            }
Example #3
0
 public void Sub(FixedPoint b)
 {
     _value -= b._value;
 }
Example #4
0
 public void Mul(FixedPoint b)
 {
     _value  *= b._value;
     _value >>= FractionalBits;
 }
Example #5
0
 public void Add(FixedPoint b)
 {
     _value += b._value;
 }