Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. double value = 0;
  2. double preValue;
  3. int n = 1;
  4. int k = 1;
  5. if (Math.abs(arg - 1) <= 1) {
  6. do {
  7. preValue = value;
  8. value -= ((Math.pow(-1, n) * Math.pow(-1 + arg, n)) / n);
  9. n++;
  10. } while (accuracy <= Math.abs(value - preValue) && n < MAX_ITERATIONS);
  11. } else if (Math.abs(arg - 1) > 1) {
  12. do {
  13. preValue = value;
  14. value += calc(arg - 1) - ((Math.pow(-1, n) * Math.pow(-1 + arg, n)) / n);
  15. k++;
  16. } while (accuracy <= Math.abs(value - preValue) && k < MAX_ITERATIONS);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement