|
![](/i/fill.gif) |
clipka <nomail@nomail> wrote:
> Only base-2 logarithms? Hey, big deal :)
> Base-x logarithms (with constant x) are easily done computing the base-2
> logarithm and dividing the result by a constant (namely the base-2 logarithm of
> x).
In fact, the opcode which calculates the base-2 logarithm is given a
factor. That factor is, rather obviously, the logarithm of the real base
you want it to calculate. So you get, in fact, a logarithm in *any* base
with one single opcode.
Btw, another advantage of using the FPU rather than calculating in
software is that you could, at least in theory, have the FPU calculating
your operation while the CPU does other (non-FPU) operations at the same
time. I don't know if any compiler is able to opimize like this, though.
(Of course the same is probably true of the SSE unit as well.)
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |