Logarithm

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Is it possible to calculate the logarithm in ASM without a LUT?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes! You can evaluate a series to obtain the "ln" of a number until you have the required accuracy.
For logarithms for other bases you will have to do a conversion.
Much more straight forward when you use a C maths library though!

Charles Darwin, Lord Kelvin & Murphy are always lurking about!
Lee -.-
Riddle me this...How did the serpent move around before the fall?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here's a complete FP lib (mostly in Asm):

http://svn.savannah.nongnu.org/v...

In particular see:

http://svn.savannah.nongnu.org/v...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow! Thanks a lot guys! I thought it wasn't possible!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I thought it wasn't possible!

With enough memory and time the AVR core can do any calculation a quad-core PC can manage. Take alook at:

http://en.wikipedia.org/wiki/Turing_completeness

Cheers,

Joey

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I thought it wasn't possible!

How "big" a processor do you think is in your $5 calculator?

If a C library has the log function you desire and that library is applicable to AVRs, then how could it not be "possible"?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Calculating Log with integers: https://www.avrfreaks.net/index.p...

Visit AVR Assembler site http://avr-asm.tripod.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:
Quote:

I thought it wasn't possible!

How "big" a processor do you think is in your $5 calculator?

If a C library has the log function you desire and that library is applicable to AVRs, then how could it not be "possible"?

Not possible with my knowledge ;)