Given the following test:
[Fact]
public void FactMethodName()
{
var d = 6.4133;
var actual = d.ToString("R");
Assert.Equal("6.4133", actual);
}
It is passed on x86 but not on Any CPU or x64:
Assert.Equal() Failure
Position: First difference is at position 5
Expected: 6.4133
Actual: 6.4132999999999996
The question is why that happens? Note that not all double values behave this way.
I understand about issues with floating point. No need to point me to wikipedia. No need to point out that test is incorrect -- it just illustrates the problem -- change it to Console.WriteLine(..);
if you will.
UPDATE I removed mentions of test runners becasue those details turned out to be irrelevant.