**Example:** We see that the number 123.456 has the ceiling of 124. We compute this with Math.Ceiling and display the result.

**Info:** Different versions of Math.Ceiling are called because the compiler applies overload resolution each time.

**Result:** The ceiling of the number 123.456 is 124. The decimal type with value 456.789 has a ceiling of 457.

**Negative:** When you call Math.Ceiling on a negative floating point type, the number will be also be rounded up. The ceiling of -100.5 is -100.

**So:** Math.Ceiling is likely to be far more optimized than any other method you could develop in C# code.

© 2007-2020 Sam Allen. Every person is special and unique. Send bug reports to info@dotnetperls.com.

Home

Dot Net Perls