avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] Re: Tables


From: David Brown
Subject: [avr-gcc-list] Re: Tables
Date: Wed, 04 Mar 2009 20:30:12 +0100
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)

David VanHorn wrote:
How would I construct a lookup table of logarithms in program memory? I'll need the logarithm of N entries between 0 and 1, ex: If N = 10, then I need log(0), log(0.1), log(0.2) etc. I don't know what precision I'll need yet, but I'll need to be adjusting N, so manually creating the table with a spreadsheet would be one way, though icky.
I'm hoping there's a way to have the compiler generate it for me?

Before you get that far, what do you want the logs for? And what base (if it matters)? And what speed and accuracy? If you need low speed and high accuracy, just use the standard C log function. If you need high speed and low accuracy and low code space, a find-first-one function will give you a start. And if you decide that a table is the best answer, consider first normalizing your numbers (unless you are using floating point, in which case they are already normalized), and consider using a non-linear table.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]