Another option we might have is to use the upper 10 bits of the
mantissa as an index into a lookup table.  That isn't so academically
pleasing but could be more efficient for our purposes.   If we find
we're short on block RAMs, but we have random logic available, then
we'll have use your technique.

On 9/28/07, Philipp Klaus Krause <[EMAIL PROTECTED]> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Timothy Normand Miller schrieb:
> > For the MIP maps?  In that case, not much.  Otherwise, I'm just
> > talking about general stuff, so the precision requirement depends on
> > the problem.
>
> I've looked at implementing logarithms on computers a bit in the last
> few days (I'm interested in how to efficiently compute them in shaders).
> Since we need log2 for the mantissa the approximation has to be good in
> the interval [1,2[ only.
> While there are much better algorithms for computing log than the
> following solution these more better algorithms are more efficient at
> high precisions only.
> I suggest a power series approximation based on the aretangens hyperbolicus:
> Let c(k) := 2/(ln(2) * (2k + 1)), p(x,k) := ((x-1)/(x+1))^(2k + 1)
> Then log2(x) = c(0)p(x,0) + c(1)p(x,1) + c(2)p(x,2) + ...
>
> If you don't need a lot of precision just take the first few summands only:
> Just c(0)p(x,0) will approximate log2 with a maximum error of 0.04.
> c(0)p(x,0)+c(1)p(x,1) will approximate log2 with a maximum error of 0.0025
> c(0)p(x,0)+c(1)p(x,1)+c(2)p(x,2) gives maximum error of 0.0002
> c(0)p(x,0)+c(1)p(x,1)+c(2)p(x,2)+c(3)p(x,3) gives maximum error of 0.000018
>
> I've attached the subsection on log2 of something I'm currently writing
> for university. While it might be useful, this is just a small piece of
> a mostly unfinished document and might contain errors.
>
> Philipp
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFG/RDabtUV+xsoLpoRAvAlAKDZP4O1fz1dOfxPnCb+PA0J5rJiJACfSEZu
> soYiGKArOuIupq0KRjizMN4=
> =NCg7
> -----END PGP SIGNATURE-----
>
>


-- 
Timothy Normand Miller
http://www.cse.ohio-state.edu/~millerti
Open Graphics Project
_______________________________________________
Open-graphics mailing list
[email protected]
http://lists.duskglow.com/mailman/listinfo/open-graphics
List service provided by Duskglow Consulting, LLC (www.duskglow.com)

Reply via email to