C
C#2y ago
hagan

❔ Why does it do this?

I'm learning C# and this makes no sense the answer is 3.3 and that's it why does it try to exact it and make it wrong still?
No description
No description
7 Replies
Angius
Angius2y ago
Floating point rounding errors That's just how floating points work. Not every floating point number can be represented in binary, so what we often get is the best approximation
hagan
haganOP2y ago
oh ok thank you!
Jimmacle
Jimmacle2y ago
there is a nice tool here that you can use to experiment and see why this happens https://www.h-schmidt.net/FloatConverter/IEEE754.html
jcotton42
jcotton422y ago
🎵 pigeon hole principle 🎵
Arch Leaders
Arch Leaders2y ago
Decimal Struct (System)
Represents a decimal floating-point number.
jcotton42
jcotton422y ago
decimal stil has limitations it's just much better in the precision department than float or double
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?