Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Ho to do fast log routine in x86 Assembler

Avatar of drtester
drtester asked on
3 Comments1 Solution1083 ViewsLast Modified:

I am working with some audio dsp code that is using floating point numbers, ranging from 1.0e-8 to 1000.  I want to convert this value to a dB value, which will be an integer value from -160 to 60.  The usual formula is:

   result = log10(value) * 20

I currently do this with some code that looks like this:

    fld value.single
     fld x6.single
     fstp result

where x6 = a constant value of 6.  This works, but it seems that the fyl2x instruction eats up a ton of cycles.  I've got to do this a LOT in the code, and it needs to be very fast.  I'm not opposed to large lookup tables, if that's what it takes.

How can I improve on this?  The result only needs to be integer values - no fractional amounts are needed.  Code will be run on Pentium 4 and higher CPUs only.

Avatar of drtester

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answers