scale = 100180
/* Arctan: Using the formula:
atan(x) = atan(c) + atan((x-c)/(1+xc)) for a small c (.03 here)
For under .03, use the series:
atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ... */
define mya(x) {
auto a,b,e,f,i,n,s,v,z
z = scale;
if (x > .03) {
scale = z+5;
a = mya(.03);
}
scale = z+3;
while (x > .03) {
f += 1;
x = (x-.03) / (1+x*.03);
}
v = n = x;
s = -x*x;
for (i=3; 1; i+=2) {
e = (n *= s) / i;
if (e == 0) {
scale = z;
return (f*a+v);
}
v += e
}
}
enderg=4*mya(1)
scale=100000
enderg/1
quit
syntax highlighted by Code2HTML, v. 0.9.1