I think every single time I've used
Math.Ceiling or its language variant, I've always had to cast it to an integer. I mean... that's the whole point, isn't it? To get a whole number. So why doesn't it just return an
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
For one, REALs/FLOATs usually have a much greater range. The result might not fit into an INTEGER.
100000000000000000000 is a LargePositiveInteger, meaning an integer that uses more than 32 bits in its representation.
As Michael points out, the above answer is wrong. I didn't notice that while the answer was an integer the answer was wrong because the float loses precision. So instead here's another, CORRECT, version, which works because we don't use floats: