Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2007-05-17 04:26:39


"Michael Marcin" <mmarcin_at_[hidden]> writes:

> Anthony Williams wrote:
>>
>> Of course, it wouldn't take too much effort to write a program to
>> spew out the tables for each and every possible set of precisions.
>> The generated source files could be then be compiled as normal, and
>> the compiler could dutifully put the values in ROM as desired.
>>
>
> These are just integer calculations.
> Shouldn't we be able to calculate arbitrarily precise tables at
> complile-time using meta-programming?
>
> I'd probably put the calculations in a separate lib and explictly
> instantiate them for the types/precision I care about as there would
> probably a noticeable hit for such complex meta-programming math but I'd
> rather do that than use an external code generator.

If you fancy writing a template metaprogram to calculate atan or logarithms,
go ahead! Actually calculating the values from scratch in a reasonable length
of time is more than I could manage in a *run-time* solution --- the lookup
tables make it several orders of magnitude faster. I think the extra compile
time complexity would either make the compiler keel over, or the compile take
ridiculously long.

Anyway, I was suggesting that the code generator be run exactly once (unless
it needed to be modified for some reason, e.g. to change the rounding rules
for better overall accuracy, or change the values for which the atan and
natural log are calculated), and then the generated code kept in CVS.

Anthony

-- 
Anthony Williams
Just Software Solutions Ltd - http://www.justsoftwaresolutions.co.uk
Registered in England, Company Number 5478976.
Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk