pastebin

Paste Search Dynamic
Recent pastes
jijyou
  1. #include <stdio.h>
  2. #include <math.h>
  3. double jijyou (double x){
  4. return x*x*x*x-5.0;
  5. }
  6. int main(void){
  7. double x=0.0;
  8. int i=0;
  9. double a=0.0,b=10.0,c,eps=0.000000000000001;
  10. if (jijyou(a)*jijyou(b)>0){
  11. b=b*2.0;
  12. a=a-1000;}
  13. do {
  14. c=x;
  15. if (jijyou(b)*jijyou(c)<0)
  16. a=c;
  17. else
  18. b=c;
  19. x=(a+b)/2.0;
  20. printf("%d %.20lf %.20lf¥n",i,x,a-x);
  21. i=i+1;} while (fabs(a-x)>eps);
  22. return 0;
  23. }
Parsed in 0.005 seconds