function signum(num) {
    if (num < 0) {
        return -1;
    }
    else if (num === 0) {
        return 0;
    }
    else {
        return 1;
    }
}
The signum function.

@return 1 if num > 0, -1 if num < 0, and 0 if num = 0