The float keyword signifies a simple type that stores 32-bit floating-point values. To initialize a float variable, use the suffix f or F, as in the following example:
float x = 3.5F;
You can mix numeric integral types and floating-point types in an expression. In this case, the integral types are converted to floating-point types. The evaluation of the expression is performed according to the following rules:
- If one of the floating-point types is double, the expression evaluates to double or bool in relational or Boolean expressions.
- If there is no double type in the expression, the expression evaluates to
floator bool in relational or Boolean expressions.
A floating-point expression can contain the following sets of values:
- Positive and negative zero
- Positive and negative infinity
- Not-a-Number value (NaN)
- The finite set of nonzero values
The double keyword signifies a simple type that stores 64-bit floating-point values. If you want an integer number to be treated as double, use the suffix d or D, for example
double x = 3D;
You can mix numeric integral types and floating-point types in an expression. In this case, the integral types are converted to floating-point types. The evaluation of the expression is performed according to the following rules:
- If one of the floating-point types is
double, the expression evaluates todouble, or bool in relational or Boolean expressions. - If there is no
doubletype in the expression, it evaluates to float, or bool in relational or Boolean expressions.
A floating-point expression can contain the following sets of values:
- Positive and negative zero.
-
Positive and negative infinity.
- Not-a-Number value (NaN).
- The finite set of nonzero values.
The decimal keyword indicates a 128-bit data type. Compared to other floating-point types, the decimal type has more precision and a smaller range, which makes it appropriate for financial and monetary calculations.
If you want a numeric real literal to be treated as decimal, use the suffix m or M. Without the suffix m, the number is treated as a double and generates a compiler error.

The integral types are implicitly converted to decimal and the result evaluates to decimal. Therefore you can initialize a decimal variable using an integer literal, without the suffix, as follows:
decimal myMoney = 300;
There is no implicit conversion between other floating-point types and the decimal type; therefore, a cast must be used to convert between these two types. For example:
decimal myMoney = 99.9m;
double x = (double)myMoney;
myMoney = (decimal)x;
(in this cast, the decimal has been converted into a double)
You can also mix decimal and numeric integral types in the same expression. However, mixing decimal and other floating-point types without a cast causes a compilation error.
Rferences for this article can be found here: float double decimal
Also, more informations about value types and how to use them properly on C# can be found here: value types
