on-internet
← Community

Cast float to decimal in C#. Why is (decimal)0.1F == 0.1M not false because of rounding?

Stack Overflow ·

If I evaluate the following in C#, it yields true: (decimal)0.1F == 0.1M Why doesn't the conversion to float and back to decimal introduce any rounding errors?

Comments

Sign in or sign up to comment and upvote.

No comments yet.