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: Nightly
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).

signum

signum(a: Int) -> Int

Returns the sign of an integer value.

This helper function determines whether a number is positive, negative, or zero, returning 1 for positive, -1 for negative, and 0 for zero.

Args:

  • a (Int): The integer value to determine the sign of.

Returns:

Int: 1 if a > 0, -1 if a < 0, 0 if a == 0.