|
|
1.1 root 1: double fabs();
2: double cubrt(a)
3: double a;
4: {
5: double x,y,x1;
6: if(a==0)
7: return(0.);
8: y = 1;
9: if(a<0) {
10: y = -y;
11: a = -a;
12: }
13: while(a<1) {
14: a *= 8;
15: y /= 2;
16: }
17: while(a>1) {
18: a /= 8;
19: y *= 2;
20: }
21: x = 1;
22: do {
23: x1 = x;
24: x = (2*x1+a/(x1*x1))/3;
25: } while(fabs(x-x1)>10.e-15);
26: return(x*y);
27: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.