C
C#13mo 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
Angius13mo 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
haganOP13mo ago
oh ok thank you!
Jimmacle
Jimmacle13mo 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
jcotton4213mo ago
🎵 pigeon hole principle 🎵
Arch Leaders
Arch Leaders13mo ago
Decimal Struct (System)
Represents a decimal floating-point number.
jcotton42
jcotton4213mo ago
decimal stil has limitations it's just much better in the precision department than float or double
Accord
Accord13mo 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.
Want results from more Discord servers?
Add your server