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

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

Re: [avr-gcc-list] Tables


From: Andy Warner
Subject: Re: [avr-gcc-list] Tables
Date: Wed, 4 Mar 2009 12:20:40 -0600

On Wed, Mar 4, 2009 at 12:05 PM, David VanHorn <address@hidden> 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?

Don't know of a good way to do this with the compiler/preprocessor, so
I would reach for perl/python/ruby/<insert other favourite scripting
language here>
and write a stand-alone program that runs on the host and creates a .h file with
all the data you need in it (including #defines of any constants like
N, if needed.)

Then you can put that dependency in your makefile and have the computer
recreate the file on demand.

Don't even waste a second thinking about spreadsheets; that way lies
madness.
-- 
Andy




reply via email to

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