]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Add a "kernel" log function, based on e_log.c, which is useful for
authordas <das@FreeBSD.org>
Sun, 5 Dec 2010 22:11:03 +0000 (22:11 +0000)
committerdas <das@FreeBSD.org>
Sun, 5 Dec 2010 22:11:03 +0000 (22:11 +0000)
commit225ceb18e8a1729edd452bb883adfdb72d75c769
tree194be6588ef6450b9c4dc71ae44ad99e14dec9ec
parentcec2e8182c77939ee3d4ff9ae865a9f36d437c57
Add a "kernel" log function, based on e_log.c, which is useful for
implementing accurate logarithms in different bases.  This is based
on an approach bde coded up years ago.

This function should always be inlined; it will be used in only a few
places, and rudimentary tests show a 40% performance improvement in
implementations of log2() and log10() on amd64.

The kernel takes a reduced argument x and returns the same polynomial
approximation as e_log.c, but omitting the low-order term. The low-order
term is much larger than the rest of the approximation, so the caller of
the kernel function can scale it to the appropriate base in extra precision
and obtain a much more accurate answer than by using log(x)/log(b).
lib/msun/src/k_log.h [new file with mode: 0644]
lib/msun/src/k_logf.h [new file with mode: 0644]