Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- double value = 0;
- double preValue;
- int n = 1;
- int k = 1;
- if (Math.abs(arg - 1) <= 1) {
- do {
- preValue = value;
- value -= ((Math.pow(-1, n) * Math.pow(-1 + arg, n)) / n);
- n++;
- } while (accuracy <= Math.abs(value - preValue) && n < MAX_ITERATIONS);
- } else if (Math.abs(arg - 1) > 1) {
- do {
- preValue = value;
- value += calc(arg - 1) - ((Math.pow(-1, n) * Math.pow(-1 + arg, n)) / n);
- k++;
- } while (accuracy <= Math.abs(value - preValue) && k < MAX_ITERATIONS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement