Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- double Calc_Eps(){
- double eps = 1;
- while ((eps/2 + 1) > 1) eps /= 2;
- return eps;
- }
- double Calc_Row(double x, int i){
- double ch = 1;
- double zn = 4;
- double res = 0;
- double eps = Calc_Eps();
- while ((ch/zn) > eps){
- double tmp = ch / zn;
- res += tmp;
- ch *= x*x*x*x;
- zn *= 4;
- i++;
- }
- return res;
- }
- int main(){
- int i = 0;
- double x = 0.5;
- printf("%lf\n", x);
- x = 1/ (4 - x*x*x*x);
- printf("%.20lf\n", x);
- x = Calc_Row(x , i);
- printf("%.20lf%d" , x , i);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement