Why Math.Ceiling returns double?
问题 In C# the method Math.Ceiling returns a double value. Why does it not return int ? 回答1: The documentation says about the return value: The smallest whole number greater than or equal to a. If a is equal to NaN, NegativeInfinity, or PositiveInfinity, that value is returned. Therefore the return value has to be double since NaN, NegativeInfinity and PositiveInfinity are fields of Double. 回答2: double has a greater value range than int : The Double value type represents a double-precision 64-bit