From: Martin Bonner (Martin.Bonner_at_[hidden])
Date: 2007-05-16 06:41:04
>>> I like the ability to specify the number of bits either side of the
>>> decimal point, but this does get in the way for doing the math
>>> functions --- you need a table with magic numbers in at the
>>> appropriate precision for exp and sin/cos.
>> Presumably the tables could be computed at run time once per type.
> Yes, but that would add to the app startup cost, or make the first
> math function call *very* expensive. The arctan table (for sin and
> cos) has 30 entries, and the log tables used for exp total 91
> entries. 30 calls to atan and 91 calls to log can take a while.
If you were doing this in a loop, yes, but as a single, one time,
startup cost? Even if each call to atan/log takes a microsecond, and
you use all 64 different precisions, that's *still* only a few
milliseconds on the startup - who is going to care?
Um. If you are doing this in an embedded 16-bit processor (which is
just the sort of place that fixed point often /is/ useful), that
microsecond might be a bit optimistic - and you would really want the
constants in ROM not RAM.
> If you increase the precision, then you
> need more entries than that.
-- Martin Bonner Project Leader PI SHURLOK LTD Telephone: +44 1223 441434 / 203894 (direct) Fax: +44 1223 203999 Email: martin.bonner_at_[hidden] www.pi-shurlok.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk