1044
According to Characteristics of the floating-point types:
| .NET Type | C# Keyword | Precision |
|---|---|---|
System.Single |
float | ~6-9 digits |
System.Double |
double | ~15-17 digits |
System.Decimal |
decimal | 28-29 digits |
The way I've been stung by using the wrong type (a good few years ago) is with large amounts:
You run out at 1 million for a float.
A 15 digit monetary value:
9 trillion with a double. But with division and comparisons it's more complicated (I'm definitely no expert in floating point and irrational numbers - see Marc's point). Mixing decimals and doubles causes issues:
A mathematical or comparison operation that uses a floating-point number might not yield the same result if a decimal number is used because the floating-point number might not exactly approximate the decimal number.
When should I use double instead of decimal? has some similar and more in