Re: [stella] Polar to Cartesian Co-Ordinate Converter

On Mon, 22 Oct 2001, Thomas Jentzsch wrote:
> While I knew the square tables based multiplication, the logarithmic formulas are new to me (or maybe I've forgotten them since school). Thanks!
Hi everyone...
Here's a short refresher for logarithm based arithmetic:
Notation: log_a(b) is the base a logarithm of b
then by definition, log_a(a^b) = b
e.g. log_10(10^3) = 3
e.g. log_e(e^7) = 7
General properties: (the number base doesn't matter)
b*log(a) = log(a^b)
log(a) + log(b) = log (a*b)
log(a) - log(b) = log (a/b)
If you're given a log table for one number base, but need to take the
log in an arbitrary number base, use the following formula:
given the tables for log_a: log_b(c) = log_a(c) / log_a(b)
e.g. log_e(100) = log_10(100) / log_10(e) = 4.605170186
-> e^4.605170186 = 100
Most calculators have built in log functions for base 10 (=log) and
base e (=ln). But you sometimes need to take the base 2 log of a number,
so that last can be very useful.
e.g. log_2(128) = log(128)/log(2) = 7 (pretty trivial)
e.g. log_2(128000000000) = log(128000000000)/log(2) = 36.89735285
Why is that useful? Well, now I know that I need 37 bits to represent
the number 128000000000! :)
Etc...
> Especially the fast division may open some new opportunites. To bad, that I can't use them for my new demo, since I need the remainder too :-(
> You don't know a formula for this, do you?
Ummmm...I'm not sure what your question is. If you take your log tables out
far enough (enough digits, that is) You'll get frational answers.
I.e. (assuming base 10 log tables)
If log(128) = 2.10720997 and log(7) = 0.84509804 then 128/7 = 18.2857143.
If log(128) = 2.10720 and log(7) = 0.84509 then 128/7 = 18.28563304
If log(128) = 2.10 and log(7) = 0.84 then 128/7 = 18.19700859
I think you should just be able look at the most significant n-bits for
the quotient and the rest is the remainder.
I'm not sure if this helps.
> I guess, the rounding error could be further reduced by using 16 bit value tables (for LOG only of course :-) Correct?
Yes. More bits in the log table gives better precision.
-Chris
-
Archives (includes files) at http://www.biglist.com/lists/stella/archives/
Unsub & more at http://www.biglist.com/lists/stella/