Because 8.0 is a perfectly good floating point number.
Let's generalize the concept of math.ceil
to include a "digits" parameter; that is, you get to choose the number of digits after the decimal point that you want to keep. This isn't as far-fetched as it sounds; the Round function already has this ability.
By this new definition, Math.Ceil(12.755, 2)
would return 12.76, which you wouldn't be able to return as an int
. The only values that could be returned as int
would be those of the form Math.Ceil(x, 0)
, but it probably doesn't make much sense to have a function that returns a different type based on the value of one of its input parameters.
Anyway, it's more convenient to stay in the floating-point realm for working with these numbers, especially since any subsequent math on the returned numbers is almost certainly going to involve floating point anyway.