Did you know that when you are dealing with numbers, by default, .NET will do, or try to do exactly what you tell it to do? If you tell it to do the impossible, it will do the next most logical thing. It won’t throw any errors in the process.
No, neither did I. But then, most of the time I don’t write code where this would matter, and I bet you don’t either.
So here are some examples.
Continue reading “CSharp Numeric Overflows”
Podcast: Play in new window | Download
When you need to deal with a number that is a fraction, what do you specify for its type? If you are like most programmers I know, you’ll reach for Float (Single if you are using VB) or Double.
If you are working with currency, though, this could get you into a lot of trouble.
Continue reading “Decimal vs Float (Single) or Double”