Module Name: src Committed By: apb Date: Sat Jul 16 22:30:26 UTC 2011
Modified Files: src/sys/dev/dtv: dtv_math.c Log Message: Instead of returning an integer between 0 and 31 (scaled by 1<<24), use (0.5 + x/2 - 1/x) as an approximation to log2(x) for x from 1 to 2, and scale the input to fit this range. Now the error is always less than 0.2%. Also add an test program, hidden behind #ifdef TEST_DTV_MATH, to print a table of expected and actual results, and the errors. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/dtv/dtv_math.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.