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 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

For more information about these values, see IEEE Standard for Binary Floating-Point Arithmetic, available on the IEEE Web site.

In the following example, an int, a short, and a float are included in a mathematical expression giving a float result. (Remember that float is an alias for the System.Single type.) Notice that there is no double in the expression.