Below are a couple of suggestions to check your calculation:

Is the calculation for gradapprox correct? bearing mind that the operator * and / have higher precedence than + and - in the expression, and you need to use parenthesis to enforce the correct order as shown in the formula

what is the value of the numerator and denominator ? use print statement to print the values.