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