Write a program to reverse a number without using string functions.
Implement reverse_number(num), which accepts an integer and returns its digits in reverse order as an integer. Preserve the sign for negative inputs and return 0 when the input is 0 or contains only zeros after reversal. Do not convert the number to a string or use string-processing operations.
def reverse_number(num):