What is the assertion statement being used? Here're what I see is wrong / odd with your function:
- F is actually the pi value estimate, but it is not an output to your function
- numsig is not used in your function to check the significant digits
- N_terms is not calculated or used in your function
- numsigP and numsigR are not used after the while loop
- numsigP and numsigR are the same values
- estimate can be calculated in just the last loop. Ex:
n = 99;
sum = 4 * (((- 1) ^ n) / (2 * n + 1));
estimate = 4 * sum; % Equals -.0804 regardless of 100 iterations or just last iteration.
To determine significant figures, see this post here which talks about it:
