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



Peter Dickerson schrieb:

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.

10% will definitely not be enough...

The input data is in fixed point format, so the range can be choosen
rather freely - however the differences in the input data already are
small (say about 1/1000), and the flatness of the log curve makes them
even smaller in the log result. So the mantissa surely has to be taken
into account...

Tilmann

--
http://www.autometer.de - Elektronik nach Maß.
.