Both descriptions in MSDN and C# 5.0 Specification are correct.
C# expressions are unchecked
by default. Take a look at the bold part again;
- In an unchecked context, the conversion always succeeds, and proceeds as follows.
- If the value of the operand is NaN or infinite, the result of the conversion is an unspecified value of the destination type.
- Otherwise, the source operand is rounded towards zero to the nearest integral value. If this integral value is within the range of the destination type then this value is the result of the conversion.
First, let's take a look what Specification says:
rounded towards zero to the nearest integral value
Let's analyze it on number line
;
As we can see, result will be 123 when we round towards zero.
Second, let's take a look what MSDN says:
When you convert from a double or float value to an integral type, the value is truncated
From Wikipedia
page;
In mathematics and computer science, truncation is the term for limiting the number of digits right of the decimal point.
Note that in some cases, truncating would yield the same result as rounding, but truncation does not round up or round down the digits; it merely cuts off at the specified digit.
As we can see, result will be 123
when we truncate it also.