I still want fast approximations of the logarithm and the inverse tangent function for my work. I don’t know if they are really needed, but they are nice pillow problems to keep you from ruminating those stupid things happening now.

If x is in a limited range, 0<x_min<x<x_max, then you can approximate log(x) with a simple table. Because of the singularity at x=0 and other properties of the logarithm you should use a size of about 1000*(x_max/x_min) to get a good approximation. For more details see http://bookofgames.ch/specialFastLog.html.

Results are similar as for the exponential function: Firefox is about 4 times faster than Chrome and the approximation of log(x) is about 4 times faster too.

I have put the timing loop in a separate function. This lowered the measured times considerably. I suppose that the JavaScript engine made better optimizations.

### Like this:

Like Loading...

*Related*