The assignment was to create a program to estimate the factorial of a positive integer using Gosper's formula. I changed it to display intermediate values to find the error, and it looks like root_part is only using the "2n" and not the full "2n + 1/3", but I can't figure out why it's doing that. Reversing them had no effect either. The rest seems accurate given the wrong root_part value.
Any help would be greatly appreciated.
#define PI 3.14159265
printf("Enter a positive integer> ");
root_partial = (1 / 3) + (2 * n);
printf("Variable root_part = %f \n", root_part);
root_solved = sqrt(root_part * PI);
printf("Variable root_solved = %f \n", root_solved);
n_factorial = (pow(n,n) * exp(-n)) * root_solved;
printf("%.0f! equals approximately %.5f \n", n, n_factorial);