Re: Simple/Fast Algorithm for binary logarithm in C (on ARM7)



"Vladimir Vassilevsky" <antispam_bogus@xxxxxxxxxxx> wrote in message
news:us%0i.2641$zj3.1035@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx


Tilmann Reh wrote:

in a current ARM7 project I need to do some calculations which include a
logarithm. All other math is done with integers (i.e. fixed point
arithmetic), and I would like to calculate the log fast and with little
code - so I don't prefer using FP conversion and the standard math
libraries.

Can anyone point to fixed-point logarithmic routines I could use (resp.
tailor to my needs)?


It all depends on how accurate the log function should be. If you are fine
with 10% accuracy, just count the insignificant bits and then do a
simplest linear approximation.

The OP didn't give an input range or accuracy requirement so its hard to
guess what is best. The thing we do know is that its for an ARM7, which has
a reasonable multiplier, so better than linear shouldn't be a issue.

Peter


.