Why is floating point arithmetic in C# imprecise?

Floating point only has so many digits of precision. If you’re seeing f1 == f2, it is because any difference requires more precision than a 32-bit float can represent.

I recommend reading What Every Computer Scientist Should Read About Floating Point

Leave a Comment