Wrong value for auto-sum in query results

I discovered that the sum of a single-precision floating point column isn't always being computed correctly by Linqpad (v...)

Here's a contrived case that reproduces the problem:

var data = new[] {
new { Val = 1.0E+07f },
new { Val = 0.1E+07f },
}
.Dump();
Console.WriteLine($"Expected sum: {data.Sum(c => c.Val)}");

image

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!