Calculates the absolute value of a function.