Approximating the logarithm function

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

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.




This entry was posted in programming and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s