Skip to main content

Mojo function

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.

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

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

Args:

Returns:

IntLiteral: The ceiling of dividing numerator by denominator.

Was this page helpful?