IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0.0b1
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

ceildiv

ceildiv[T: CeilDivable, //](numerator: T, denominator: T) -> T

Return the rounded-up result of dividing numerator by denominator.

Parameters:

  • T (CeilDivable): A type that support floor division.

Args:

  • numerator (T): The numerator.
  • denominator (T): The denominator.

Returns:

T: The ceiling of dividing numerator by denominator.

ceildiv[T: CeilDivableRaising, //](numerator: T, denominator: T) -> T

Return the rounded-up result of dividing numerator by denominator, potentially raising.

Parameters:

Args:

  • numerator (T): The numerator.
  • denominator (T): The denominator.

Returns:

T: The ceiling of dividing numerator by denominator.

Raises:

If the operation fails.

ceildiv(numerator: IntLiteral, denominator: IntLiteral) -> IntLiteral[(0 - (numerator.value // (0 - denominator.value)))]

Return the rounded-up result of dividing numerator by denominator.

Args:

Returns:

IntLiteral[(0 - (numerator.value // (0 - denominator.value)))]: The ceiling of dividing numerator by denominator.