Function sign

  • Returns the sign of a number.

    Parameters

    • num: number

      The number to determine the sign of.

    Returns number

    The sign of the number: -1 if negative, 0 if zero, 1 if positive.

    Static

    Example

    sign(-5);    // Returns -1
    sign(0); // Returns 0
    sign(10); // Returns 1
  • Returns the sign of a bigint.

    Parameters

    • num: bigint

      The bigint to determine the sign of.

    Returns number

    The sign of the bigint: -1 if negative, 0 if zero, 1 if positive.

    Static

    Example

    sign(-5n);    // Returns -1
    sign(0n); // Returns 0
    sign(10n); // Returns 1

Generated using TypeDoc