[linux-dvb] [PATCH]Frontends or51132, or51211 move common code
to module
Trent Piepho
xyzzy at speakeasy.org
Thu Apr 20 05:46:40 CEST 2006
On Wed, 19 Apr 2006, Rusty Scott wrote:
>On Wed, 2006-04-19 at 08:49 +0200, christophpfister at bluemail.ch wrote:
>> Sorry to have concurrenced you, but manu told me to create one. Anyway, the
>> error (not the accurancy!!) is now < 0.047%.
>>
>Not really a concurrence, because yours is a log base2 where mine is a
>log base 10. (Actually a 10*log10 for use in dB calcaulations) Now you
>have a place to put your function when it is ready (if my patch is
>ack'd) and we could eventually base the log10 calculations on the log2
>functions with the appropriate conversion factor.
Christoph's code has a log10 function that does just that, returning the log10
in 4.24 fixed-point. It's much more accurate than Jack Kelliher's code to do
the same thing. Still, I can do even better:
This is for log base 10 over the range 1 to 2^24
Author Max % error Max abs error CPU Time
------------------------------------------------------
Jack 0.844475% 0.0211893 19.08
Christoph 0.0462607% 0.00179902 6.66
Trent 256 0.000136763% 0.00000682604 7.74
Trent 128 0.000216441% 0.00000729513 7.75
Trent 64 0.000646134% 0.0000160004 7.77
Trent 32 0.00276062% 0.0000546169 7.74
Jack's code uses two tables, one with 200 32-bit values and another with
9 32-bit values.
Christoph's code uses two tables, one with 256 8-bit values and another with
256 16-bit values.
The four versions of my code uses a single table with 256, 128, 64, or 32
16-bit values, respectively. Even with a lookup table one eighth the size, my
code is still twenty times more accurate.
Here is a graph of the relative error over the range 0-64k:
http://www.speakeasy.org/~xyzzy/log10.png
More information about the linux-dvb
mailing list