Is double Multiplication Broken in .NET? [duplicate]

Because you’ve misunderstood floating point arithmetic and how data is stored.

In fact, your code isn’t actually performing any arithmetic at execution time in this particular case – the compiler will have done it, then saved a constant in the generated executable. However, it can’t store an exact value of 6.9, because that value cannot be precisely represented in floating point point format, just like 1/3 can’t be precisely stored in a finite decimal representation.

See if this article helps you.

Leave a Comment