Re: Simple/Fast Algorithm for binary logarithm in C (on ARM7)
- From: "Peter Dickerson" <firstname.lastname@xxxxxxxxxxxxxxxx>
- Date: Fri, 11 May 2007 11:35:35 GMT
"Tilmann Reh" <tilmannreh@xxxxxxxxxxxxx> wrote in message
news:464433e9$0$23133$9b4e6d93@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello all,
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)?
I had a need for log of an integer with the result fixed point. For fixed
point input there is just a constant difference. I didn't hugely accurate
results, but the results are better than I needed. Input was signed 32-bit
integer and result was ln(x) as 32-bit fixed point with 24-bit fraction.
log10(x) was then obtained by scaling. There is no particular reason why the
input can't be unsigned.
However, the method requires a 256-entry 32-bit int table, a 256-entry byte
table and one integer divide :-(
I can't give out the source code because of copyright constraints but I'm
happy to explain the algorithm.
Peter
.
- Follow-Ups:
- Re: Simple/Fast Algorithm for binary logarithm in C (on ARM7)
- From: Spoon
- Re: Simple/Fast Algorithm for binary logarithm in C (on ARM7)
- From: Tilmann Reh
- Re: Simple/Fast Algorithm for binary logarithm in C (on ARM7)
- References:
- Simple/Fast Algorithm for binary logarithm in C (on ARM7)
- From: Tilmann Reh
- Simple/Fast Algorithm for binary logarithm in C (on ARM7)
- Prev by Date: Re: Simple/Fast Algorithm for binary logarithm in C (on ARM7)
- Next by Date: Custom Software Development
- Previous by thread: Re: Simple/Fast Algorithm for binary logarithm in C (on ARM7)
- Next by thread: Re: Simple/Fast Algorithm for binary logarithm in C (on ARM7)
- Index(es):