Does anyone have a custom math atan script that I can use?
I need it so that I get the same output in both C# and AS3.
Thank you very much!
by mfranzs » July 6th, 2011, 11:45 pm
by jasonMcIntosh » July 8th, 2011, 4:48 pm
by mfranzs » July 8th, 2011, 8:31 pm
function atan(r)
{
return r/(1+(r*r/(3+(4*r*r)/(5+(9*r*r)/(7+(16*r*r)/(9+(25*r*r)/(11+(36*r*r)/(13+(49*r*r)/(15+(64*r*r)/(17+(81*r*r)))))))))));
}
by jasonMcIntosh » July 9th, 2011, 12:09 am
by mfranzs » July 9th, 2011, 12:37 am
function atan(r)
{
return r/(1+(r*r/(3+(4*r*r)/(5+(9*r*r)/(7+(16*r*r)/(9+(25*r*r)/(11+(36*r*r)/(13+(49*r*r)/(15+(64*r*r)/(17+(81*r*r)))))))))));
}
var start=(new Date()).getTime();
var sum=0;
for(var i=0;i<1000000;i++){
sum+=atan(i);
}
trace("Custom: "+((new Date()).getTime()-start));
start=(new Date()).getTime();
sum=0;
for(i=0;i<1000000;i++){
sum+=Math.atan(i);
}
trace("Built in: "+((new Date()).getTime()-start));
Custom: 1309
Built in: 856
by Benjaminsen » July 9th, 2011, 5:58 pm
by jasonMcIntosh » July 9th, 2011, 9:22 pm