The function seems to perform various calculations on the input values. However, there are some input values where the function returns undefined or results in an error.

