0

Testing multiplying 10.10 x 10.10. Which I should get 102.01 but instead got this error message. What should do to past this test?

Error message: Message: Assert.AreEqual failed. Expected:<102.01>. Actual:<102.01>.

    public double Multiply(double number1, double number2)
    {
        return number1 * number2; 
    }

    [TestMethod]
    public void TestMutliplyTwoDiffPostitionNumber()
    {
        Calculator obj = new Calculator();
        var result = obj.Mutliply(10.10, 10.10);
        Assert.AreEqual(102.01, result);
    }
P. Coker
  • 7
  • 3
  • 3
    Possible duplicate of [Comparing double values in C#](https://stackoverflow.com/questions/1398753/comparing-double-values-in-c-sharp) – Peska Jan 26 '19 at 09:31

1 Answers1

0

If you switch double to decimal, you will get an exact match. Since you only use two decimals as precision, you should be safe.